摘要: 题目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. (Easy) 分析: 不用考虑KMP啥的 阅读全文
posted @ 2016-08-16 21:18 wangxiaobao1114 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, 阅读全文
posted @ 2016-08-16 21:15 wangxiaobao1114 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac 阅读全文
posted @ 2016-08-16 21:10 wangxiaobao1114 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题意: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k th 阅读全文
posted @ 2016-08-15 19:14 wangxiaobao1114 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题意: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Yo 阅读全文
posted @ 2016-08-15 19:11 wangxiaobao1114 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 题意: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. (Hard) 分析: 方法1: 利用做过的merge 2 sorted list,将头两个归并 阅读全文
posted @ 2016-08-13 21:41 wangxiaobao1114 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 题意: iven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is 阅读全文
posted @ 2016-08-13 21:05 wangxiaobao1114 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 题意: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array 阅读全文
posted @ 2016-08-12 22:12 wangxiaobao1114 阅读(215) 评论(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 @ 2016-08-12 22:06 wangxiaobao1114 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题意: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integ 阅读全文
posted @ 2016-08-11 14:03 wangxiaobao1114 阅读(161) 评论(0) 推荐(0) 编辑