### LeetCode

LeetCode中题目的解答，希望在这里记录下学习的足迹。

4 已关注
94篇博文
• #### LeetCode104:Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long...

2015-08-13 23:25
574
• #### LeetCode218:The Skyline Problem

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe...

2015-08-04 11:09
2407
• #### LeetCode146:LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the fol...

2015-08-02 10:05
1341

2015-07-30 11:22
1789
• #### LeetCode222:Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W...

2015-07-29 17:17
1146
• #### LeetCode229:Majority Element II

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The alg...

2015-07-29 15:13
1264
• #### LeetCode230:Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. ...

2015-07-29 11:16
561
• #### LeetCode231:Power of Two

Given an integer, write a function to determine if it is a power of two. Credits: Special thanks t...

2015-07-29 10:14
799
• #### LeetCode236:Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. Accord...

2015-07-27 15:57
520

Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n...

2015-07-27 15:47
708
• #### LeetCode235:Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS...

2015-07-24 16:18
554
• #### LeetCode203:Remove Linked List Elements

Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 -...

2015-07-24 15:46
1371
• #### LeetCode237:Delete Node in a Linked List

Write a function to delete a node (except the tail) in a singly linked list, given only access to th...

2015-07-24 15:22
625
• #### LeetCode227:Basic Calculator II

Implement a basic calculator to evaluate a simple expression string.The expression string contains o...

2015-07-20 16:48
818
• #### LeetCode11:Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai)...

2015-07-20 16:46
1203
• #### LeetCode42:Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, comput...

2015-07-20 16:22
581
• #### LeetCode238:Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is eq...

2015-07-20 15:56
831
• #### LeetCode224:Basic Calculator

Implement a basic calculator to evaluate a simple expression string.The expression string may contai...

2015-07-15 16:04
747
• #### LeetCode173:Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro...

2015-07-14 16:14
548
• #### LeetCode145:Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary ...

2015-07-14 11:21
592