摘要:Search a 2D MatrixWrite an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row...
阅读全文
摘要:Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be...
阅读全文
摘要:Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−...
阅读全文
摘要:First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Yo...
阅读全文
摘要:Sudoku SolverWrite a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that the...
阅读全文
摘要:Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are ...
阅读全文
摘要:Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2)....
阅读全文
摘要:Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity ...
阅读全文
摘要:Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ...
阅读全文
摘要: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 an...
阅读全文
摘要:Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a...
阅读全文
摘要:Binary Tree Postorder TraversalGiven a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \...
阅读全文
摘要:Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level...
阅读全文
摘要:Binary Tree Level Order TraversalGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).Fo...
阅读全文
摘要:Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then...
阅读全文
摘要:Divide Two IntegersDivide two integers without using multiplication, division and mod operator.不用* 、/、%来做除法。只能加减了啊亲!算法思路:一个一个加上去必超时,例如dividend = Integ...
阅读全文
摘要:Regular Expression MatchingImplement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more o...
阅读全文
摘要:Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
阅读全文
摘要:Container With Most WaterGivennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such t...
阅读全文
摘要:Trapping Rain WaterGivennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to tr...
阅读全文