发布时间:2015-03-22 17:00:36
import java.util.ArrayList;import java.util.List;//Given an index k, return the kth row of the Pascal's triangle.////For example, given k = 3,//Return [1,3,3,1].////Note://Could you optimize your algorithm to use only O(k) extra space?public class PascalTriangleTwo {public static void .........【阅读全文】
发布时间:2015-03-22 16:59:20
mport java.util.ArrayList;import java.util.List;//Given numRows, generate the first numRows of Pascal's triangle.////For example, given numRows = 5,//Return////[// [1],// [1,1],// [1,2,1],// [1,3,3,1],// [1,4,6,4,1]//]public class PascalsTriang.........【阅读全文】
发布时间:2015-03-22 16:58:34
//Palindrome Number Total Accepted: 35430 Total Submissions: 122024 My Submissions Question Solution //Determine whether an integer is a palindrome. Do this without extra space.public class PalindromeNumber {public boolean isPalindrome(int x) { if(x<0)&nb.........【阅读全文】
发布时间:2015-03-22 16:56:29
/Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.class Point { int x; int y; Point() { x = 0; y = 0; } Point(int a, int b) { x = a; y = b; } }public class MaxPoints {public sta.........【阅读全文】