摘要: 题目:There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have to f... 阅读全文
posted @ 2015-06-01 20:45 可爱的波儿胖 阅读(374) 评论(0) 推荐(0) 编辑
摘要: 题目:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3... 阅读全文
posted @ 2015-06-01 11:29 可爱的波儿胖 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a range [m, n] where 0 >= 1; n >>= 1; offset++; } return m << offset; }}参考链接:http://blog.csdn.... 阅读全文
posted @ 2015-06-01 10:47 可爱的波儿胖 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjace... 阅读全文
posted @ 2015-06-01 09:59 可爱的波儿胖 阅读(231) 评论(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 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) 编辑

友情链接 : CodeForge源码分享