摘要: 题目描述:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in ... 阅读全文
posted @ 2015-03-11 15:18 Sawyer Ford 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. A... 阅读全文
posted @ 2015-03-11 08:25 Sawyer Ford 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the tel... 阅读全文
posted @ 2015-03-05 15:09 Sawyer Ford 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 本文结论: const对象、指向const对象的指针或引用只能用于调用其const成员函数。实例说明:class A{public: void mf1(){ cout<<"Function Call"<<endl; } void mf2() const{ cout<<"const F... 阅读全文
posted @ 2015-03-04 22:27 Sawyer Ford 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the su... 阅读全文
posted @ 2015-02-11 10:15 Sawyer Ford 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target.Return the sum of the three integers.Yo... 阅读全文
posted @ 2015-02-10 18:46 Sawyer Ford 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:E... 阅读全文
posted @ 2015-02-09 14:53 Sawyer Ford 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Write a function to find the longest common prefix string amongst an array of strings. 题目很唬人,搞清楚前缀的意思就简单了。解题思路就四个字:垂直匹配。solution:string longestC... 阅读全文
posted @ 2015-02-08 11:23 Sawyer Ford 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 这道题很简单,我就直接贴答案了。solution1:int romanTo... 阅读全文
posted @ 2015-02-06 21:37 Sawyer Ford 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999. 这道题我必须炫一下,因为提交一次就成功了,而且代码很赞。solution:... 阅读全文
posted @ 2015-02-06 08:50 Sawyer Ford 阅读(148) 评论(0) 推荐(0) 编辑