04 2016 档案

摘要:Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 阅读全文
posted @ 2016-04-30 13:52 新一代的天皇巨星 阅读(129) 评论(0) 推荐(0)
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2016-04-28 11:38 新一代的天皇巨星 阅读(158) 评论(0) 推荐(0)
摘要:224. Basic Calculator Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parent 阅读全文
posted @ 2016-04-27 13:42 新一代的天皇巨星 阅读(175) 评论(0) 推荐(0)
摘要:Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another e 阅读全文
posted @ 2016-04-27 13:01 新一代的天皇巨星 阅读(139) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2016-04-26 14:10 新一代的天皇巨星 阅读(149) 评论(0) 推荐(0)
摘要:Given a list of non negative integers, arrange them such that they form the largest number. Given a list of non negative integers, arrange them such t 阅读全文
posted @ 2016-04-25 13:46 新一代的天皇巨星 阅读(117) 评论(0) 推荐(0)
摘要:141. Linked List Cycle Given a linked list, determine if it has a cycle in it. 142. Linked List Cycle II 142. Linked List Cycle II Given a linked list 阅读全文
posted @ 2016-04-25 13:04 新一代的天皇巨星 阅读(280) 评论(0) 推荐(0)
摘要:Sort a linked list in O(n log n) time using constant space complexity. Hide Tags Linked List Sort Hide Similar Problems (E) Merge Two Sorted Lists (M) 阅读全文
posted @ 2016-04-25 09:21 新一代的天皇巨星 阅读(157) 评论(0) 推荐(0)
摘要:198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only cons 阅读全文
posted @ 2016-04-22 14:05 新一代的天皇巨星 阅读(1483) 评论(0) 推荐(0)
摘要:Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
posted @ 2016-04-20 23:23 新一代的天皇巨星 阅读(147) 评论(0) 推荐(0)
摘要:Type will be erased by compiler. So you cannot check against the parametized check as below. Code: Compiler warning message: Output: How to get the pa 阅读全文
posted @ 2016-04-15 05:58 新一代的天皇巨星 阅读(327) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2016-04-14 13:45 新一代的天皇巨星 阅读(146) 评论(0) 推荐(0)
摘要:121. Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitte 阅读全文
posted @ 2016-04-14 13:31 新一代的天皇巨星 阅读(308) 评论(0) 推荐(0)
摘要:Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? Linked List Two Pointers With extr 阅读全文
posted @ 2016-04-14 13:20 新一代的天皇巨星 阅读(239) 评论(0) 推荐(0)
摘要:Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement bot 阅读全文
posted @ 2016-04-13 13:19 新一代的天皇巨星 阅读(112) 评论(0) 推荐(0)
摘要:21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th 阅读全文
posted @ 2016-04-12 13:15 新一代的天皇巨星 阅读(153) 评论(0) 推荐(0)
摘要:Code is everything: 阅读全文
posted @ 2016-04-10 05:45 新一代的天皇巨星 阅读(182) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5" 阅读全文
posted @ 2016-04-09 12:55 新一代的天皇巨星 阅读(161) 评论(0) 推荐(0)