摘要:dude, visited[i - 1] == 0 should be visited[i - 1] == 1, you are suppose to skip this one if it is a duplicate
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要:Longest Valid ParenthesesMaximal RectanglePermutation Sequencesudoku solver最长公共子序列及打印3Sum ClosestJan 18 '123SumJan 18 '124SumJan 27 '12Add BinaryApr 2...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
阅读全文
摘要:{4,4,8}倒还好,不过{4,8}就会有问题了。这里倒是一个bug。一个可用的办法就是用一个visited数组来记录已经被访问的元素。不过我也懒的改了。就用双指针扫描的办法好了。
阅读全文
摘要:同学你好,google到你的帖子,想问下为什么你的解法不用考虑到2个数相同的情况?比如4,4,8
阅读全文