05 2015 档案

摘要:题目:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such poss... 阅读全文
posted @ 2015-05-26 10:51 可爱的波儿胖 阅读(212) 评论(1) 推荐(0) 编辑
摘要:题目:Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].思... 阅读全文
posted @ 2015-05-21 10:03 可爱的波儿胖 阅读(151) 评论(0) 推荐(0) 编辑
摘要:题目I:Reverse a singly linked list思路:建立三个指针,一个用来维护链表头,另外两个再循环中,维护head的前一位和保存反转的后一位。 逐个反转,首先反转前两个,然后把前两个看成是一个,继续循环反转下去。代码:public class Solution { p... 阅读全文
posted @ 2015-05-19 20:28 可爱的波儿胖 阅读(171) 评论(0) 推荐(0) 编辑
摘要:题目:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total num... 阅读全文
posted @ 2015-05-19 10:31 可爱的波儿胖 阅读(418) 评论(0) 推荐(0) 编辑
摘要:题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or... 阅读全文
posted @ 2015-05-18 17:57 可爱的波儿胖 阅读(157) 评论(0) 推荐(0) 编辑
摘要:题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2-... 阅读全文
posted @ 2015-05-18 16:26 可爱的波儿胖 阅读(131) 评论(0) 推荐(0) 编辑
摘要:题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted arraynums=[1,1,1,2,2,3],Your function should... 阅读全文
posted @ 2015-05-17 20:48 可爱的波儿胖 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"Corner Cases:Did you con... 阅读全文
posted @ 2015-05-15 10:38 可爱的波儿胖 阅读(157) 评论(0) 推荐(0) 编辑

友情链接 : CodeForge源码分享