126. Word Ladder II

2016-08-11
阅读 3 分钟
2.8k
题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:

Leetcode中Path的题目总结

2016-08-09
阅读 1 分钟
2.8k
Matrix中的path问题:62.Unique Paths63.Unique Paths II这两题是典型的dp问题,要求一共有多少种方案。分析状态f(i, j)是走到(i, j)总共的路径。它可以由前面两个状态得到,即f(i, j)=f(i - 1, j) + f(i, j - 1)。最后注意边界值即可。变形是有设obstacle, 那么遇到obstacle的时候,把当前可行路径设为0即可。

352. Data Stream as Disjoint Intervals

2016-08-04
阅读 2 分钟
2.9k
题目:Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of disjoint intervals.

287. Find the Duplicate Number

2016-08-03
阅读 2 分钟
2.4k
题目:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.

302. Smallest Rectangle Enclosing Black Pixels

2016-08-02
阅读 3 分钟
3.4k
题目:An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one black region. Pixels are connected horizontally and vertically. Given the location (x, y) of one of the black pixels, return the area of the sma...

220. Contains Duplicates

2016-08-02
阅读 2 分钟
2.5k
题目:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j is at most k.

127. Word Ladder

2016-07-31
阅读 3 分钟
2.7k
题目:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:

71. Simplify Path

2016-07-28
阅读 2 分钟
2.6k
For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.

212. Word SearchII

2016-07-28
阅读 4 分钟
2.7k
题目:Given a 2D board and a list of words from the dictionary, find all words in the board.

306. Additive Number

2016-07-26
阅读 3 分钟
4.3k
题目:Additive number is a string whose digits can form additive sequence.

209. Minimum Size Subarray Sum

2016-07-25
阅读 1 分钟
2.1k
题目:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.

368. Largest Divisible Subset

2016-07-21
阅读 2 分钟
2.9k
题目:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.

142. Linked List CycleII

2016-07-20
阅读 1 分钟
2k
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

42. Trapping Rain Water

2016-07-19
阅读 2 分钟
2.3k
题目: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.

11. Container with Most Water

2016-07-19
阅读 1 分钟
1.9k
题目: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 endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the m...

277. Find the Celebrity

2016-07-18
阅读 2 分钟
2.4k
题目:Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her but he/she does not know any of them.

289. Life of Game

2016-07-18
阅读 4 分钟
2.2k
问题:According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."

246. 247. 248. Strobogrammatic Number I II II

2016-07-18
阅读 4 分钟
4.6k
246.Strobogrammatic NumberI题目:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).

360. Sort Transformed Array

2016-07-15
阅读 1 分钟
3.5k
题目:Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array.

268. Missing Number

2016-07-15
阅读 1 分钟
2.2k
题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

348. Design Tic-Tac-Toe

2016-07-15
阅读 4 分钟
3k
题目:Design a Tic-tac-toe game that is played between two players on a n x n grid.

260. Single NumberIII

2016-07-14
阅读 1 分钟
2.1k
题目:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.

238. Product of Array Except Self

2016-07-14
阅读 1 分钟
1.9k
问题: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 of nums except nums[i].

370. Range Addition

2016-07-13
阅读 2 分钟
7k
题目:Assume you have an array of length n initialized with all 0's and are given k update operations.

157. Read N Characters Given Read4

2016-07-12
阅读 2 分钟
2.6k
题目:The API: int read4(char *buf) reads 4 characters at a time from a file.

160. Intersection of Two Linked Lists

2016-07-12
阅读 1 分钟
2.7k
题目:Write a program to find the node at which the intersection of two singly linked lists begins.

286. Walls and Gates

2016-07-12
阅读 2 分钟
2.5k
题目:You are given a m x n 2D grid initialized with these three possible values.

364. Nested List Weight SumII

2016-07-12
阅读 2 分钟
6k
题目:Given a nested list of integers, return the sum of all integers in the list weighted by their depth.

329. Longest Increasing Path in a Matrix

2016-07-11
阅读 2 分钟
2.3k
题目:Given an integer matrix, find the length of the longest increasing path.

301. Remove Invalid Parenthesis

2016-07-10
阅读 2 分钟
4.7k
问题:Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.