- 博客(4)
- 收藏
- 关注
原创 最大子序列和问题的解_
问题:有数n1,n2,......,ns。求一个连续的子序列,这个序列的和最大。这个问题有O(n^3)、O(n^2)、O(n*lgn)以及O(n)时间复杂度的解法。下面主要说下O(n*lgn)和O(n)的解法。
2016-12-14 19:47:43 498
原创 Min Stack_栈_保存最小值(用数组)
题目:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- G
2016-12-09 20:25:18 360
原创 204. Count Primes_找n以内的质数_hash
题目以及解法思路答案在原网页上都有。https://leetcode.com/problems/count-primes/Description:Count the number of prime numbers less than a non-negative number, n.Hint:Let's start with a isPrime function.
2016-12-08 20:03:58 355
原创 Implement strStr()--字符串匹配_kmp_bkdHash
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.两种方法:1)bkdHash2)kmp代码分别如下://bkdHashint strStr(string
2016-12-08 19:08:11 358
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人