摘要:        
原题链接在这里:https://leetcode.com/problems/balanced-binary-tree/ 题目: Given a binary tree, determine if it is height-balanced. For this problem, a height-ba    
阅读全文
 
        
        
            posted @ 2015-09-05 00:44
Dylan_Java_NYC
阅读(203)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/reorder-list/ 题目: Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must    
阅读全文
 
        
        
            posted @ 2015-09-03 05:49
Dylan_Java_NYC
阅读(194)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ 题目: Given an array where elements are sorted in ascending order, con    
阅读全文
 
        
        
            posted @ 2015-09-03 04:04
Dylan_Java_NYC
阅读(262)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ 题目: Given a singly linked list where elements are sorted in ascending    
阅读全文
 
        
        
            posted @ 2015-09-03 03:36
Dylan_Java_NYC
阅读(376)
推荐(0)
        
        
            
        
        
            
摘要:        
Private means this could only be seen within this class. Protected means "package private", this could be seen by subclasses and package members. | Cl    
阅读全文
 
        
        
            posted @ 2015-09-03 03:07
Dylan_Java_NYC
阅读(149)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/sort-list/ 题目: Sort a linked list in O(n log n) time using constant space complexity. 题解: divide and conquer. 从中    
阅读全文
 
        
        
            posted @ 2015-09-03 02:59
Dylan_Java_NYC
阅读(177)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/insertion-sort-list/ 题目: Sort a linked list using insertion sort. 题解: 与Sort List类似. 当出现cur.val > cur.next.val时就需    
阅读全文
 
        
        
            posted @ 2015-09-03 01:16
Dylan_Java_NYC
阅读(221)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ 题目: Follow up for "Remove Duplicates":What if duplicates are allowed at     
阅读全文
 
        
        
            posted @ 2015-09-02 13:01
Dylan_Java_NYC
阅读(315)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 题目: Given a sorted array, remove the duplicates in place such that each ele    
阅读全文
 
        
        
            posted @ 2015-09-02 12:38
Dylan_Java_NYC
阅读(195)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ 题目: Given a sorted linked list, delete all nodes that have duplicate numb    
阅读全文
 
        
        
            posted @ 2015-09-02 12:25
Dylan_Java_NYC
阅读(268)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/remove-duplicates-from-sorted-list/ 题目: Given a sorted linked list, delete all duplicates such that each element    
阅读全文
 
        
        
            posted @ 2015-09-02 12:19
Dylan_Java_NYC
阅读(279)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/partition-list/ 题目: Given a linked list and a value x, partition it such that all nodes less than x come before     
阅读全文
 
        
        
            posted @ 2015-09-01 04:28
Dylan_Java_NYC
阅读(262)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/linked-list-cycle-ii/ 题目: Given a linked list, return the node where the cycle begins. If there is no cycle, ret    
阅读全文
 
        
        
            posted @ 2015-09-01 03:45
Dylan_Java_NYC
阅读(303)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/linked-list-cycle/ 题目: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it withou    
阅读全文
 
        
        
            posted @ 2015-08-29 22:12
Dylan_Java_NYC
阅读(192)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/swap-nodes-in-pairs/ 题目: Given a linked list, swap every two adjacent nodes and return its head. You must solve     
阅读全文
 
        
        
            posted @ 2015-08-29 21:51
Dylan_Java_NYC
阅读(218)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接:https://leetcode.com/problems/add-two-numbers/ 题目: You are given two linked lists representing two non-negative numbers. The digits are stored in    
阅读全文
 
        
        
            posted @ 2015-08-29 05:39
Dylan_Java_NYC
阅读(270)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/intersection-of-two-linked-lists/ 题目: Write a program to find the node at which the intersection of two singly l    
阅读全文
 
        
        
            posted @ 2015-08-29 04:07
Dylan_Java_NYC
阅读(246)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/palindrome-linked-list/ 题目: Given a singly linked list, determine if it is a palindrome. Follow up:Could you do     
阅读全文
 
        
        
            posted @ 2015-08-29 03:19
Dylan_Java_NYC
阅读(242)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/remove-nth-node-from-end-of-list/ 题目: Given a linked list, remove the nth node from the end of list and return i    
阅读全文
 
        
        
            posted @ 2015-08-29 01:00
Dylan_Java_NYC
阅读(214)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/reverse-nodes-in-k-group/ 题目: Given a linked list, reverse the nodes of a linked list k at a time and return its    
阅读全文
 
        
        
            posted @ 2015-08-27 02:53
Dylan_Java_NYC
阅读(239)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接:https://leetcode.com/problems/remove-linked-list-elements/ 题目: Remove all elements from a linked list of integers that have value val. ExampleGiv    
阅读全文
 
        
        
            posted @ 2015-08-23 00:14
Dylan_Java_NYC
阅读(184)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/reverse-linked-list-ii/ 题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For exam    
阅读全文
 
        
        
            posted @ 2015-08-22 05:20
Dylan_Java_NYC
阅读(342)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/reverse-linked-list/ 题目: Reverse a singly linked list. 题解: Iteration 方法: 生成tail = head, cur = tail, while loop 的    
阅读全文
 
        
        
            posted @ 2015-08-22 04:15
Dylan_Java_NYC
阅读(409)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/evaluate-reverse-polish-notation/ 题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation.    
阅读全文
 
        
        
            posted @ 2015-08-22 01:10
Dylan_Java_NYC
阅读(181)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/basic-calculator-ii/ 题目: Implement a basic calculator to evaluate a simple expression string. The expression str    
阅读全文
 
        
        
            posted @ 2015-08-21 12:21
Dylan_Java_NYC
阅读(421)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/basic-calculator/ 题目: Implement a basic calculator to evaluate a simple expression string. The expression string    
阅读全文
 
        
        
            posted @ 2015-08-21 09:42
Dylan_Java_NYC
阅读(338)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ 题目: Given a binary tree, return the zigzag level order traversal of it    
阅读全文
 
        
        
            posted @ 2015-08-21 07:48
Dylan_Java_NYC
阅读(272)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/binary-tree-level-order-traversal/ 题目: Given a binary tree, return the level order traversal of its nodes' value    
阅读全文
 
        
        
            posted @ 2015-08-21 06:54
Dylan_Java_NYC
阅读(384)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/ 题目: Given inorder and postorder traversal of a tree,    
阅读全文
 
        
        
            posted @ 2015-08-21 03:03
Dylan_Java_NYC
阅读(229)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 题目: Given preorder and inorder traversal of a tree, c    
阅读全文
 
        
        
            posted @ 2015-08-21 02:33
Dylan_Java_NYC
阅读(300)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/majority-element/ 题目: Given an array of size n, find the majority element. The majority element is the element t    
阅读全文
 
        
        
            posted @ 2015-08-20 10:32
Dylan_Java_NYC
阅读(292)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/binary-tree-postorder-traversal/ 题目: Given a binary tree, return the postorder traversal of its nodes' values. F    
阅读全文
 
        
        
            posted @ 2015-08-20 08:01
Dylan_Java_NYC
阅读(339)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/binary-tree-inorder-traversal/# 题目: Given a binary tree, return the inorder traversal of its nodes' values. For     
阅读全文
 
        
        
            posted @ 2015-08-20 02:48
Dylan_Java_NYC
阅读(336)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/binary-tree-preorder-traversal/ 题目: Given a binary tree, return the preorder traversal of its nodes' values. For    
阅读全文
 
        
        
            posted @ 2015-08-19 09:15
Dylan_Java_NYC
阅读(439)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里: https://leetcode.com/problems/min-stack/ 题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time    
阅读全文
 
        
        
            posted @ 2015-08-19 05:07
Dylan_Java_NYC
阅读(296)
推荐(0)
        
        
 
    
    
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/valid-parentheses/ 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine     
阅读全文
 
        
        
            posted @ 2015-08-18 12:02
Dylan_Java_NYC
阅读(168)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/implement-queue-using-stacks/ 题目: Implement the following operations of a queue using stacks. push(x) -- Push el    
阅读全文
 
        
        
            posted @ 2015-08-18 11:35
Dylan_Java_NYC
阅读(219)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/implement-stack-using-queues/ 题目: Implement the following operations of a stack using queues. push(x) -- Push el    
阅读全文
 
        
        
            posted @ 2015-08-18 10:57
Dylan_Java_NYC
阅读(264)
推荐(0)
        
        
            
        
        
            
摘要:        
这是一道面试亚马逊时的题目,要求Time O(n). 我刚开始想的是算出所有的数的总product,再去除以对应位置的元素,但这种做法的问题是若该位置为0,就会报错。到网上搜了下,才知道,原来有这种做法。e.g. arr = {0,1,2,3},生成两个array: upArr = {1,arr[0...    
阅读全文
 
        
        
            posted @ 2015-08-18 04:09
Dylan_Java_NYC
阅读(171)
推荐(0)
        
        
            
        
        
            
摘要:        
原题链接在这里:https://leetcode.com/problems/multiply-strings/ 题目: Given two non-negative integers num1 and num2 represented as strings, return the product o    
阅读全文
 
        
        
            posted @ 2015-08-18 03:32
Dylan_Java_NYC
阅读(295)
推荐(0)