摘要: Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]./**... 阅读全文
posted @ 2015-07-26 23:13 ~每天进步一点点~ 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-07-26 22:57 ~每天进步一点点~ 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?因为f... 阅读全文
posted @ 2015-07-26 22:21 ~每天进步一点点~ 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *... 阅读全文
posted @ 2015-07-26 21:55 ~每天进步一点点~ 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-07-26 20:46 ~每天进步一点点~ 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-07-26 20:09 ~每天进步一点点~ 阅读(128) 评论(0) 推荐(0) 编辑
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ... 阅读全文
posted @ 2015-07-26 19:53 ~每天进步一点点~ 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.public class Solution { public int singleNumber(in... 阅读全文
posted @ 2015-07-26 18:50 ~每天进步一点点~ 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... 阅读全文
posted @ 2015-07-26 17:01 ~每天进步一点点~ 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-07-26 16:58 ~每天进步一点点~ 阅读(153) 评论(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-07-26 16:36 ~每天进步一点点~ 阅读(880) 评论(0) 推荐(1) 编辑
摘要: Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes are labeled uniq... 阅读全文
posted @ 2015-07-26 15:56 ~每天进步一点点~ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文
posted @ 2015-07-26 14:53 ~每天进步一点点~ 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv... 阅读全文
posted @ 2015-07-26 13:51 ~每天进步一点点~ 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2015-07-26 12:55 ~每天进步一点点~ 阅读(140) 评论(0) 推荐(0) 编辑