上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 43 下一页

2015年9月20日

30. Substring with Concatenation of All Words (String; HashTable)

摘要: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a conca 阅读全文

posted @ 2015-09-20 13:51 joannae 阅读(199) 评论(0) 推荐(0) 编辑

2015年9月17日

29. Divide Two Integers (INT; Overflow, Bit)

摘要: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 思路I:做减法,直到被除数<除数。但结果 Time Limit Exceed 阅读全文

posted @ 2015-09-17 06:40 joannae 阅读(276) 评论(0) 推荐(0) 编辑

2015年9月16日

28. Implement strStr() (String)

摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.class Solution {public: ... 阅读全文

posted @ 2015-09-16 08:43 joannae 阅读(174) 评论(0) 推荐(0) 编辑

2015年9月15日

27.Remove Element(Array)

摘要: 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-09-15 10:31 joannae 阅读(128) 评论(0) 推荐(0) 编辑

26.Remove Duplicates from Sorted Array(Array)

摘要: 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 space fo 阅读全文

posted @ 2015-09-15 10:28 joannae 阅读(137) 评论(0) 推荐(0) 编辑

2015年8月23日

25.Reverse Nodes in k-Group (List)

摘要: 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 then l 阅读全文

posted @ 2015-08-23 08:59 joannae 阅读(194) 评论(0) 推荐(0) 编辑

2015年8月12日

24.Swap Nodes in Pairs (List; Two-Pointers)

摘要: 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-08-12 21:13 joannae 阅读(242) 评论(0) 推荐(0) 编辑

2015年8月11日

23.Merge k Sorted Lists (Array, Queue; Sort)

摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路I: 选择排序 每次都比较各个list的头指针所指的val,取最小的那个。时间复杂度O(n*k) 阅读全文

posted @ 2015-08-11 18:45 joannae 阅读(202) 评论(0) 推荐(0) 编辑

2015年8月5日

22.Generate Parentheses (String; Back-Track)

摘要: Given 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 @ 2015-08-05 18:49 joannae 阅读(181) 评论(0) 推荐(0) 编辑

2015年7月30日

21.Merge Two Sorted Lists (List)

摘要: 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./** * Def... 阅读全文

posted @ 2015-07-30 18:33 joannae 阅读(206) 评论(0) 推荐(0) 编辑

上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 43 下一页

导航