上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页

dude, visited[i - 1] == 0 should be visited[i - 1]...

摘要: dude, visited[i - 1] == 0 should be visited[i - 1] == 1, you are suppose to skip this one if it is a duplicate 阅读全文
posted @ 2013-04-21 05:13 小刀初试 阅读(110) 评论(0) 推荐(0)

[LeetCode] Valid Number

摘要: Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the p... 阅读全文
posted @ 2013-04-14 04:20 小刀初试 阅读(173) 评论(0) 推荐(0)

[LeetCode] Permutation Sequence, Solution

摘要: The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence ... 阅读全文
posted @ 2013-04-08 10:47 小刀初试 阅读(136) 评论(0) 推荐(0)

未做题

摘要: Longest Valid ParenthesesMaximal RectanglePermutation Sequencesudoku solver最长公共子序列及打印3Sum ClosestJan 18 '123SumJan 18 '124SumJan 27 '12Add BinaryApr 2... 阅读全文
posted @ 2013-04-08 10:03 小刀初试 阅读(178) 评论(0) 推荐(0)

[LeetCode] Spiral Matrix II, Solution

摘要: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following... 阅读全文
posted @ 2013-04-08 08:18 小刀初试 阅读(146) 评论(0) 推荐(0)

[LeetCode] Merge Intervals, Solution

摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].» Solve this... 阅读全文
posted @ 2013-04-08 07:20 小刀初试 阅读(168) 评论(0) 推荐(0)

[LeetCode] Regular Expression Matching, Solution

摘要: Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.... 阅读全文
posted @ 2013-04-08 05:08 小刀初试 阅读(134) 评论(0) 推荐(0)

{4,4,8}倒还好,不过{4,8}就会有问题了。这里倒是一个bug。一个可用的办法就是用一个vis...

摘要: {4,4,8}倒还好,不过{4,8}就会有问题了。这里倒是一个bug。一个可用的办法就是用一个visited数组来记录已经被访问的元素。不过我也懒的改了。就用双指针扫描的办法好了。 阅读全文
posted @ 2013-04-03 10:50 小刀初试 阅读(149) 评论(0) 推荐(0)

同学你好, google到你的帖子,想问下为什么你的解法不用考虑到2个数相同的情况?比如4,4,8...

摘要: 同学你好,google到你的帖子,想问下为什么你的解法不用考虑到2个数相同的情况?比如4,4,8 阅读全文
posted @ 2013-04-02 15:04 小刀初试 阅读(88) 评论(0) 推荐(0)

请问这个解法的时间复杂度怎么分析?谢谢!

摘要: 请问这个解法的时间复杂度怎么分析?谢谢! 阅读全文
posted @ 2013-04-01 08:39 小刀初试 阅读(102) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 20 下一页