JasonChang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年11月6日

摘要: simple recursion problem 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 */10 public class Solution {11 public boolean isSameTree(TreeNode p, TreeNode q) {12 ... 阅读全文
posted @ 2013-11-06 03:24 JasonChang 阅读(157) 评论(0) 推荐(0) 编辑

摘要: slowrunner and fastrunner trick 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * val = x; 8 * next = null; 9 * }10 * }11 */12 public class Solution {13 public ListNode dele... 阅读全文
posted @ 2013-11-06 02:59 JasonChang 阅读(168) 评论(0) 推荐(0) 编辑

摘要: similar withRemove Duplicates from Sorted Array 1 public class Solution { 2 public int removeDuplicates(int[] A) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 if(A == null) 6 ... 阅读全文
posted @ 2013-11-06 02:34 JasonChang 阅读(202) 评论(0) 推荐(0) 编辑

摘要: simple recursion problem 1 public class Solution { 2 public int climbStairs(int n) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int[] table = new int[n+1]; 6 for(int i = 0; i <... 阅读全文
posted @ 2013-11-06 02:03 JasonChang 阅读(146) 评论(0) 推荐(0) 编辑