LeetCode - Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in th...

2013-09-27 14:49:51

阅读数 1575

评论数 0

LeetCode - Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total...

2013-09-26 22:09:15

阅读数 1830

评论数 0

LeetCode - Remove Element

Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn'...

2013-09-26 21:49:46

阅读数 1675

评论数 0

LeetCode - String to Integer (atoi)

Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see be...

2013-09-26 21:42:13

阅读数 1654

评论数 0

LeetCode - Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the las...

2013-09-26 20:43:17

阅读数 1626

评论数 0

LeetCode - Rotate Image

You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? ...

2013-09-26 18:01:13

阅读数 1638

评论数 0

LeetCode - Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). ...

2013-09-26 15:54:16

阅读数 1692

评论数 0

LeetCode - Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the neare...

2013-09-26 15:33:16

阅读数 1502

评论数 0

LeetCode - Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->...

2013-09-26 15:18:04

阅读数 1659

评论数 0

LeetCode - 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 permitted to complete at most one trans...

2013-09-26 13:23:47

阅读数 1730

评论数 0

LeetCode - Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary t...

2013-09-25 15:11:12

阅读数 1556

评论数 0

LeetCode - Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 ...

2013-09-25 14:37:27

阅读数 1349

评论数 0

LeetCode - Same Tree

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identic...

2013-09-25 14:11:00

阅读数 743

评论数 0

LeetCode - Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node cont...

2013-09-25 14:01:07

阅读数 804

评论数 0

LeetCode - Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3...

2013-09-24 17:50:40

阅读数 974

评论数 0

LeetCode - Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...

2013-09-24 14:00:04

阅读数 593

评论数 0

LeetCode - Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single...

2013-09-24 12:33:09

阅读数 534

评论数 0

LeetCode - Median of Two Sorted Arrays

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should ...

2013-09-23 13:50:28

阅读数 673

评论数 0

LeetCode - Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the t...

2013-09-22 12:08:21

阅读数 643

评论数 0

取消 删除