上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2015-01-20 23:14 胡潇 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2015-01-18 23:07 胡潇 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2015-01-18 23:07 胡潇 阅读(379) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-01-18 23:06 胡潇 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 典型的需要使用图模型将start 和 end 以及字典一同构建成图,然后探究从start到end的最短路径 阅读全文
posted @ 2015-01-16 23:51 胡潇 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Palindrome Partitioning动态规划+深度优先搜索https://leetcode.com/discuss/23480/c-solution-with-dp-and-dfs-12ms动态规划+回溯https://leetcode.com/discuss/15920/dp-and-b... 阅读全文
posted @ 2015-01-16 23:50 胡潇 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 思路完全一样AC的代码: 1 class Solution { 2 private: 3 struct Point { 4 int x, y; 5 Point(int _x, int _y):x(_x), y(_y) {} 6 ... 阅读全文
posted @ 2015-01-16 23:48 胡潇 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep... 阅读全文
posted @ 2015-01-16 23:47 胡潇 阅读(221) 评论(0) 推荐(0) 编辑
摘要: There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[... 阅读全文
posted @ 2015-01-15 22:34 胡潇 阅读(241) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2015-01-15 22:33 胡潇 阅读(147) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页