JasonChang

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

2013年11月13日

摘要: recursion 1 public class Solution { 2 public ArrayList> combine(int n, int k) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 ArrayList> result = new ArrayList>(); 6 if(n list = ... 阅读全文
posted @ 2013-11-13 15:33 JasonChang 阅读(231) 评论(0) 推荐(0) 编辑

摘要: 判断左右哪一半sorted对那一边进行binary search 1 public class Solution { 2 public boolean search(int[] A, int target) { 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 return ... 阅读全文
posted @ 2013-11-13 15:14 JasonChang 阅读(152) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public int search(int[] A, int target) { 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 return -1; 7 int left = 0; 8 ... 阅读全文
posted @ 2013-11-13 15:03 JasonChang 阅读(158) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public ArrayList grayCode(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 ArrayList result = new ArrayList(); 6 if(n >1));11 return res... 阅读全文
posted @ 2013-11-13 03:24 JasonChang 阅读(151) 评论(0) 推荐(0) 编辑