class Solution { public: int lengthOfLongestSubstring(string s) { int hashTable[255]; fill(hashTable, hashTable+255, -1); int start = 0, maxLen = 0; for(i... Read More
posted @ 2017-06-17 17:51 chengcy Views(94) Comments(0) Diggs(0) Edit
方法:记录便利过程中的best profit Best Time to Buy and Sell Stock II Read More
posted @ 2017-06-17 15:56 chengcy Views(158) Comments(0) Diggs(0) Edit
方法:使用一个变量记录能到达的最远距离 Jump Game II Read More
posted @ 2017-06-10 20:00 chengcy Views(136) Comments(0) Diggs(0) Edit
方法:采用二分查找 Read More
posted @ 2017-06-10 19:02 chengcy Views(121) Comments(0) Diggs(0) Edit
方法:采用分治的方法,x^n = x^n/2*x^n/2*x^n%2; Read More
posted @ 2017-06-10 18:12 chengcy Views(79) Comments(0) Diggs(0) Edit
方法:使用递归的方式实现: Read More
posted @ 2017-06-10 18:02 chengcy Views(131) Comments(0) Diggs(0) Edit
方法:采用递归的方式 Valid Sudoku 判别方法同上 Read More
posted @ 2017-06-10 17:07 chengcy Views(160) Comments(0) Diggs(0) Edit
方法:采用递归的方式 Combination Sum II 方法:每次递归中当前数据只访问一次,这里面需要注意一个细节问题:当原始vector中存在重复数字时,最终的结果会出现重复 也可以使用一个简单的flag变量 Combination Sum III 方法同上 Read More
posted @ 2017-06-03 15:33 chengcy Views(121) Comments(0) Diggs(0) Edit
方法:采用递归的方式 Read More
posted @ 2017-06-03 14:34 chengcy Views(125) Comments(0) Diggs(0) Edit
方法一:动态规划 方法二:备忘录法 Read More
posted @ 2017-05-20 17:49 chengcy Views(99) Comments(0) Diggs(0) Edit