摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { p... 阅读全文
posted @ 2017-08-31 16:13
keepshuatishuati
阅读(160)
评论(0)
推荐(0)
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { public boolean isPalindrom... 阅读全文
posted @ 2017-08-31 16:01
keepshuatishuati
阅读(113)
评论(0)
推荐(0)
摘要:
class Solution { public int[] findOrder(int numCourses, int[][] prerequisites) { if(numCourses == 0) { return new int[0]; } Map> dependencies = new Ha... 阅读全文
posted @ 2017-08-31 15:49
keepshuatishuati
阅读(142)
评论(0)
推荐(0)
摘要:
/** * Definition for binary tree with next pointer. * public class TreeLinkNode { * int val; * TreeLinkNode left, right, next; * TreeLinkNode(int x) { val = x; } * } */ public clas... 阅读全文
posted @ 2017-08-31 15:08
keepshuatishuati
阅读(91)
评论(0)
推荐(0)
摘要:
class Solution { public int mySqrt(int x) { if (x 1) { int mid = start + (end - start)/2; if (mid == x / mid) { return mid; } else if ... 阅读全文
posted @ 2017-08-31 14:58
keepshuatishuati
阅读(90)
评论(0)
推荐(0)
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文
posted @ 2017-08-31 14:49
keepshuatishuati
阅读(83)
评论(0)
推荐(0)
摘要:
class Solution { public boolean isValid(String s) { if (s.length() % 2 == 1) { return false; } Stack stack = new Stack(); for (char c : s.toCh... 阅读全文
posted @ 2017-08-31 14:41
keepshuatishuati
阅读(77)
评论(0)
推荐(0)
摘要:
class Solution { public int findTargetSumWays(int[] nums, int S) { if (nums.length == 0) { return 0; } int sum = 0; for (int num : nums) { ... 阅读全文
posted @ 2017-08-31 14:30
keepshuatishuati
阅读(82)
评论(0)
推荐(0)
摘要:
class Solution { public double myPow(double x, int n) { if (x == 0.0) { return x; } double sign = n > 0 ? 1.0 : -1.0; long nn = Math.abs(Long.... 阅读全文
posted @ 2017-08-31 13:35
keepshuatishuati
阅读(63)
评论(0)
推荐(0)
摘要:
class Solution { Map startIndex; Map lengths; Random random; public Solution(int[] nums) { random = new Random(); startIndex = new HashMap(); lengths = new Ha... 阅读全文
posted @ 2017-08-31 13:26
keepshuatishuati
阅读(98)
评论(0)
推荐(0)
浙公网安备 33010602011771号