2015年6月13日
摘要: Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.本题是求除法,但是要注意int的边界值。时间:14ms,代码如下:class S... 阅读全文
posted @ 2015-06-13 23:05 NealCaffrey989 阅读(143) 评论(0) 推荐(0) 编辑
  2015年6月12日
摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.本题是简单的全词匹配问题。时间8ms,代码如下:cl... 阅读全文
posted @ 2015-06-12 20:03 NealCaffrey989 阅读(130) 评论(0) 推荐(0) 编辑
  2015年6月11日
摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2015-06-11 22:27 NealCaffrey989 阅读(131) 评论(0) 推荐(0) 编辑
  2015年6月3日
摘要: Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2015-06-03 23:01 NealCaffrey989 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2015-06-03 17:40 NealCaffrey989 阅读(134) 评论(0) 推荐(0) 编辑
  2015年6月2日
摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2015-06-02 22:04 NealCaffrey989 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.本题是多链表融合,可以选择利用归并算法思想,两两链表融合后再归并,也可以一起融合。本文是一起融合的想法,利用... 阅读全文
posted @ 2015-06-02 11:14 NealCaffrey989 阅读(135) 评论(0) 推荐(0) 编辑
  2015年6月1日
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-06-01 22:08 NealCaffrey989 阅读(114) 评论(0) 推荐(0) 编辑
  2015年4月24日
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.本题就是简单的链表... 阅读全文
posted @ 2015-04-24 09:49 NealCaffrey989 阅读(146) 评论(0) 推荐(0) 编辑
  2015年4月23日
摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2015-04-23 20:43 NealCaffrey989 阅读(130) 评论(0) 推荐(0) 编辑