10 2014 档案
[Leetcode][JAVA] Palindrome Partitioning II
摘要:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文
posted @ 2014-10-27 10:02 metalx 阅读(160) 评论(0) 推荐(0)
[Leetcode][JAVA] Sum Root to Leaf Numbers
摘要: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 @ 2014-10-27 06:52 metalx 阅读(162) 评论(0) 推荐(0)
[Leetcode][JAVA] Surrounded Regions
摘要:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region... 阅读全文
posted @ 2014-10-27 03:16 metalx 阅读(194) 评论(0) 推荐(0)
[Leetcode][JAVA] Gas Station
摘要: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 @ 2014-10-26 23:38 metalx 阅读(354) 评论(0) 推荐(0)
[Leetcode][JAVA] Palindrome Partitioning
摘要:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv... 阅读全文
posted @ 2014-10-26 11:15 metalx 阅读(107) 评论(0) 推荐(0)
[Leetcode][JAVA] Candy
摘要:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi... 阅读全文
posted @ 2014-10-25 23:55 metalx 阅读(192) 评论(0) 推荐(0)
[Leetcode][JAVA] Clone Graph, Copy List with Random Pointer
摘要:Clone Graph:Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are ... 阅读全文
posted @ 2014-10-24 08:17 metalx 阅读(219) 评论(0) 推荐(0)
[Leetcode][JAVA] Word Break II
摘要:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl... 阅读全文
posted @ 2014-10-19 10:52 metalx 阅读(288) 评论(0) 推荐(0)
[Leetcode][JAVA] Word Break
摘要:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2014-10-13 23:42 metalx 阅读(132) 评论(0) 推荐(0)
[Leetcode][JAVA] Linked List Cycle I && II
摘要:Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?使用快慢指针,如果有循环两指针必定能相遇: 1 p... 阅读全文
posted @ 2014-10-08 02:14 metalx 阅读(391) 评论(0) 推荐(0)
[Leetcode][JAVA] Reorder List
摘要:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam... 阅读全文
posted @ 2014-10-07 23:04 metalx 阅读(294) 评论(0) 推荐(0)
[Leetcode][JAVA] Binary Tree Preorder Traversal, Binary Tree Inorder Traversal, Binary Tree Postorder Traversal
摘要:Binary Tree PreOrder Traversal:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文
posted @ 2014-10-04 01:46 metalx 阅读(648) 评论(0) 推荐(0)
[Leetcode][JAVA] LRU Cache
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文
posted @ 2014-10-01 00:29 metalx 阅读(206) 评论(0) 推荐(0)