摘要: N-QueensThen-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all... 阅读全文
posted @ 2014-10-12 13:56 陆草纯 阅读(1547) 评论(0) 推荐(0) 编辑
摘要: Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p... 阅读全文
posted @ 2014-09-19 21:49 陆草纯 阅读(3162) 评论(0) 推荐(0) 编辑
摘要: Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may ... 阅读全文
posted @ 2014-09-10 13:43 陆草纯 阅读(262) 评论(0) 推荐(0) 编辑
摘要: Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thes... 阅读全文
posted @ 2014-09-08 14:03 陆草纯 阅读(332) 评论(0) 推荐(0) 编辑
摘要: Insertion Sort ListSort a linked list using insertion sort.本题是插入排序的链表版本。传统数组版本做法就是两重循环,第一重是遍历所有元素,第二重是遍历已排序部分进行插入。链表版本类似,在遍历每个元素过程中,遍历已排序部分进行插入。/** * ... 阅读全文
posted @ 2014-09-06 12:40 陆草纯 阅读(3711) 评论(0) 推荐(0) 编辑
摘要: Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ... 阅读全文
posted @ 2014-08-31 19:45 陆草纯 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about th... 阅读全文
posted @ 2014-08-21 17:34 陆草纯 阅读(726) 评论(0) 推荐(1) 编辑
摘要: Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level... 阅读全文
posted @ 2014-07-14 20:47 陆草纯 阅读(6920) 评论(0) 推荐(0) 编辑
摘要: Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文
posted @ 2014-07-10 20:05 陆草纯 阅读(4288) 评论(1) 推荐(0) 编辑
摘要: Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ... 阅读全文
posted @ 2014-07-09 21:21 陆草纯 阅读(292) 评论(1) 推荐(0) 编辑