摘要:
Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文
摘要:
Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],... 阅读全文
摘要:
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
摘要:
首先对要求的数进行质因数分解,然后求各因数的幂的积数,比如600=2^3*3^1*5^2那么因子个数是(3+1)*(1+1)*(2+1)=24public class TestYuman{ public static void main(String[] args){ i... 阅读全文
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
摘要:
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.public class Solution { ... 阅读全文
摘要:
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
摘要:
public class Solution { public double myPow(double x, int n) { //利用二分法,通过递归加速计算 //注意:1.判断n是否为负 // 2.递归结束条件,n==1和n==0 //... 阅读全文
摘要:
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.public class Solution { public Lis... 阅读全文