摘要:
Sqrt(x)Implement int sqrt(int x).Compute and return the square root of x.Examplesqrt(3) = 1sqrt(4) = 2sqrt(5) = 2sqrt(10) = 3ChallengeO(log(x))直接的做法是注... 阅读全文
摘要:
Valid SudokuDetermine whether a Sudoku is valid.The Sudoku board could be partially filled, where empty cells are filled with the character ..ExampleT... 阅读全文
摘要:
Compare StringsCompare two strings A and B, determine whether A contains all of the characters in B.The characters in string A and B are all Upper Cas... 阅读全文
摘要:
Product of Array Exclude ItselfGiven an integers array A.Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operati... 阅读全文
摘要:
Insert Node in a Binary Search TreeExampleGiven binary search tree as follow, after Insert node 6, the tree should be: 2 2 / \ ... 阅读全文
摘要:
Permutation IndexGiven a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in ... 阅读全文
摘要:
第1部分 HashMap介绍HashMap简介HashMap 是一个散列表,它存储的内容是键值对(key-value)映射。HashMap 继承于AbstractMap,实现了Map、Cloneable、java.io.Serializable接口。HashMap 的实现不是同步的,这意味着它不是线... 阅读全文
摘要:
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.ExampleFor example... 阅读全文
摘要:
Subarray SumExampleGiven [-3, 1, 2, -3, 4], return [0, 2] or [1, 3].NoteThere is at least one subarray that it's sum equals to zero.public class Solut... 阅读全文
摘要:
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... 阅读全文