上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 34 下一页

2015年3月11日

Remove Nth Node From End of List

摘要: Remove Nth Node From End of List问题:Given a linked list, remove thenthnode from the end of list and return its head.我的思路: 使用HashMap存储好位置我的代码:public cl... 阅读全文

posted @ 2015-03-11 15:37 zhouzhou0615 阅读(181) 评论(0) 推荐(0) 编辑

Sum Root to Leaf Numbers

摘要: 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-t... 阅读全文

posted @ 2015-03-11 15:21 zhouzhou0615 阅读(137) 评论(0) 推荐(0) 编辑

Reverse Integer

摘要: Reverse Integer问题:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about... 阅读全文

posted @ 2015-03-11 11:23 zhouzhou0615 阅读(111) 评论(0) 推荐(0) 编辑

Palindrome Number

摘要: Palindrome Number 问题: Determine whether an integer is a palindrome. Do this without extra space. 思路: 常用的进制遍历方法 while(num != 0) { remian = num % 进制; nu 阅读全文

posted @ 2015-03-11 10:57 zhouzhou0615 阅读(132) 评论(0) 推荐(0) 编辑

Binary Tree Level Order Traversal II

摘要: Binary Tree Level Order Traversal II问题:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, le... 阅读全文

posted @ 2015-03-11 08:49 zhouzhou0615 阅读(104) 评论(0) 推荐(0) 编辑

Path Sum

摘要: Path Sum问题:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the g... 阅读全文

posted @ 2015-03-11 08:26 zhouzhou0615 阅读(150) 评论(0) 推荐(0) 编辑

2015年3月10日

Restore IP Addresses

摘要: Restore IP Addresses问题:Given a string containing only digits, restore it by returning all possible valid IP address combinations.思路: dfs + 回溯模板我的代码1:... 阅读全文

posted @ 2015-03-10 21:37 zhouzhou0615 阅读(130) 评论(0) 推荐(0) 编辑

Subsets II

摘要: Subsets II问题:Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-desc... 阅读全文

posted @ 2015-03-10 21:14 zhouzhou0615 阅读(87) 评论(0) 推荐(0) 编辑

N-Queens

摘要: N-Queens问题:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.思路: dfs + 回溯 常用模板我的代码:pub... 阅读全文

posted @ 2015-03-10 20:22 zhouzhou0615 阅读(125) 评论(0) 推荐(0) 编辑

Subsets

摘要: Subsets问题:Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set m... 阅读全文

posted @ 2015-03-10 19:48 zhouzhou0615 阅读(172) 评论(0) 推荐(0) 编辑

上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 34 下一页

导航