- 博客(11)
- 收藏
- 关注
原创 (算法分析Week4)Count and Say[Easy]
38. Count and SayDescriptionThe count-and-say sequence is the sequence of integers with the first five terms as following:1. 1 2. 11 3. 21 4. 1211 5. 1112211 is read off as “one 1”
2017-09-30 13:02:54 241
原创 (算法分析Week3)Merge Two Sorted Lists[Easy]
21. Merge Two Sorted ListsDescriptionMerge 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.Solution考察对链表的操作,画个图一目了
2017-09-23 22:47:47 165
原创 (算法分析Week3)Reverse Integer[Easy]
7. Reverse IntegerDescriptionReverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Note: The input is assumed to be a 32-bit signed integer. Your function should r
2017-09-23 22:24:38 191
原创 (算法分析Week3)Pow(x,n)[Medium]
50. Pow(x, n)DescriptionImplement pow(x, n). 就是实现幂函数。Solution最直观的想法是递归,每次x*pow(x, n-1),觉得会超时,没写。 然后想着循环,试了一下,超时。 考虑到n个x相乘式子的对称关系,每次循环x*=x,可以把复杂度降到O(logn)Complexity analysisO(logn)Codeclass Solution
2017-09-23 22:06:31 224
原创 (算法分析Week2)3Sum[Medium]
241. Different Ways to Add Parentheses[Medium]DescriptionGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the s
2017-09-15 21:55:19 220
原创 (算法分析Week2)Two Sum[Easy]
1. Two Sum[Easy]DescriptionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and y
2017-09-15 20:48:11 276
原创 (算法分析Week1)Different Ways to Add Parentheses[Medium]
241. Different Ways to Add Parentheses[Medium] Description Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and op
2017-09-10 19:13:18 273
原创 (算法分析Week1)Majority Element[Easy]
169. Majority Element[Easy]DescriptionGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is no
2017-09-09 21:40:23 266
原创 (算法分析Week1)Maximum Subarray[Easy]
53. Maximum Subarray[Easy]DescriptionFind the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the
2017-09-09 12:06:17 215
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人