上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 26 下一页
摘要: 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-07-16 19:46 SunshineAtNoon 阅读(189) 评论(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 @ 2014-07-16 18:50 SunshineAtNoon 阅读(310) 评论(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 @ 2014-07-16 17:18 SunshineAtNoon 阅读(219) 评论(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 @ 2014-07-16 16:31 SunshineAtNoon 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort.题解:实现链表的插入排序。要注意的地方就是,处理链表插入的时候尽量往当前游标的后面插入,而不要往前面插入,后者非常麻烦。所以每次利用kepeler.next.val和head.val比较大小,而不是kepeler.val... 阅读全文
posted @ 2014-07-14 16:14 SunshineAtNoon 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list inO(nlogn) time using constant space complexity.题解:实现一个链表的归并排序即可。主要分为三部分:1.找到中点并返回的函数findMiddle;2.归并函数merge;3.排序函数sortList。数组的findM... 阅读全文
posted @ 2014-07-14 15:51 SunshineAtNoon 阅读(479) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
posted @ 2014-07-11 19:55 SunshineAtNoon 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ... 阅读全文
posted @ 2014-07-11 16:51 SunshineAtNoon 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.题解:思路比较简单,每条直线都可以表示为y=kx+b,所以对于任意三点,如果它们共线,那么它们中任意两点的... 阅读全文
posted @ 2014-07-11 12:13 SunshineAtNoon 阅读(257) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2014-07-10 20:24 SunshineAtNoon 阅读(208) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 26 下一页