31
07/2015
[LeetCode] Search in Rotated Sorted Array II
Search in Rotated Sorted Array IIFollow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a functi...
30
07/2015
[LeetCode] Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Y...
30
07/2015
[LeetCode] Word Search
Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizonta...
29
07/2015
[LeetCode] Combinations
CombinationsGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[
...
29
07/2015
[LeetCode] Set Matrix Zeroes
Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight f...
28
07/2015
[LeetCode] Minimum Path Sum
Minimum Path SumGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note:...
28
07/2015
[LeetCode] Simplify Path
Simplify PathGiven an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", =>...
28
07/2015
[LeetCode] Unique Paths II
Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 a...
27
07/2015
[LeetCode] Unique Paths
Unique PathsA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in tim...
27
07/2015
[LeetCode] Maximal Square
Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 ...