基础不牢,地动山摇!

LeetCode240:Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorte...

2015-10-21 11:04:00

阅读数:348

评论数:0

LeetCode104:Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest ...

2015-08-13 23:25:13

阅读数:575

评论数:0

LeetCode218:The Skyline Problem

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are giv...

2015-08-04 11:09:06

阅读数:2476

评论数:0

LeetCode146:LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get...

2015-08-02 10:05:04

阅读数:1432

评论数:0

LeetCode206:Reverse Linked List

Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement ...

2015-07-30 11:22:27

阅读数:1805

评论数:0

LeetCode222:Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level...

2015-07-29 17:17:00

阅读数:1186

评论数:0

LeetCode229:Majority Element II

Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) spac...

2015-07-29 15:13:11

阅读数:1284

评论数:0

LeetCode230:Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note:  You may assume k is always valid, 1 ≤ k...

2015-07-29 11:16:55

阅读数:562

评论数:0

LeetCode231:Power of Two

Given an integer, write a function to determine if it is a power of two. Credits: Special thanks to @jianchao.li.fighter for adding this problem an...

2015-07-29 10:14:21

阅读数:803

评论数:1

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. According to the definition of LCA on Wikipedia: “The l...

2015-07-27 15:57:21

阅读数:522

评论数:0

LeetCode234:Palindrome Linked List

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? 给定一个单链表,判断它的元素是否是回文。要求在...

2015-07-27 15:47:28

阅读数:715

评论数:0

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 BST. According to the definition of LCA on Wikip...

2015-07-24 16:18:04

阅读数:556

评论数:0

LeetCode203:Remove Linked List Elements

Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, v...

2015-07-24 15:46:17

阅读数:1477

评论数:0

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 that node. Supposed the linked list is 1 -> 2 -...

2015-07-24 15:22:47

阅读数:627

评论数:0

LeetCode227:Basic Calculator II

Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators a...

2015-07-20 16:48:00

阅读数:822

评论数:0

LeetCode11:Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two ...

2015-07-20 16:46:46

阅读数:1204

评论数:0

LeetCode42:Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining...

2015-07-20 16:22:02

阅读数:585

评论数:0

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 equal to the product of all the elements ofnums ...

2015-07-20 15:56:13

阅读数:852

评论数:0

LeetCode224:Basic Calculator

Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or...

2015-07-15 16:04:08

阅读数:756

评论数:0

LeetCode173:Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the n...

2015-07-14 16:14:09

阅读数:550

评论数:0

提示
确定要删除当前文章?
取消 删除