JasonChang

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

2013年11月24日

摘要: 1 public class Solution { 2 public int maxProfit(int[] prices) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 if(prices == null||prices.length == 0) 6 return 0; 7 in... 阅读全文
posted @ 2013-11-24 17:14 JasonChang 阅读(224) 评论(0) 推荐(0) 编辑

摘要: 1 /** 2 * Definition for singly-linked list. 3 * 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 boolean hasCycle(ListNode head) {14 // IMPO... 阅读全文
posted @ 2013-11-24 09:19 JasonChang 阅读(192) 评论(0) 推荐(0) 编辑

摘要: bit manipulation 1 public class Solution { 2 public int singleNumber(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 || A.length == 0) 6 return 0; 7 ... 阅读全文
posted @ 2013-11-24 08:57 JasonChang 阅读(199) 评论(0) 推荐(0) 编辑

摘要: be careful when x1 = x2 1 /** 2 * Definition for a point. 3 * class Point { 4 * int x; 5 * int y; 6 * Point() { x = 0; y = 0; } 7 * Point(int a, int b) { x = a; y = b; } 8 * } 9 */10 public class Solution {11 public int maxPoints(Point[] points) {12 // IMPORTANT: ... 阅读全文
posted @ 2013-11-24 08:43 JasonChang 阅读(360) 评论(0) 推荐(0) 编辑