2014年7月30日

摘要: 1 package leetcode; 2 3 public class ReOrderList { 4 public void reorderList(ListNode head) { 5 if(head==null||head.next==null||head.ne... 阅读全文
posted @ 2014-07-30 17:10 thehappyyouth 阅读(139) 评论(0) 推荐(0) 编辑
 
摘要: 1 package leetcode; 2 3 class ListNode { 4 int val; 5 ListNode next; 6 7 ListNode(int x) { 8 val = x; 9 next = null;10 ... 阅读全文
posted @ 2014-07-30 12:40 thehappyyouth 阅读(127) 评论(0) 推荐(0) 编辑
 

2014年7月29日

摘要: 1 package leetcode; 2 3 import java.util.HashMap; 4 import java.util.Map; 5 6 class Node{ 7 int key; 8 int value; 9 Node pre;10 Nod... 阅读全文
posted @ 2014-07-29 17:23 thehappyyouth 阅读(159) 评论(0) 推荐(0) 编辑
 
摘要: 1 package leetcode; 2 3 import java.util.Stack; 4 5 public class RPN { 6 public static int evalRPN(String[] tokens) { 7 Stack stack=n... 阅读全文
posted @ 2014-07-29 13:00 thehappyyouth 阅读(160) 评论(0) 推荐(0) 编辑
 
摘要: 1 package leetcode; 2 3 import java.util.HashMap; 4 5 class Point{ 6 int x; 7 int y; 8 Point(){ 9 x=0;10 y=0;11 }12... 阅读全文
posted @ 2014-07-29 12:59 thehappyyouth 阅读(157) 评论(0) 推荐(0) 编辑
 

2014年5月8日

摘要: 1.循环 1 public class T009 { 2 public static void main(String[] args){ 3 System.out.println(fibonacci(3)); 4 } 5 public static long ... 阅读全文
posted @ 2014-05-08 15:53 thehappyyouth 阅读(165) 评论(0) 推荐(0) 编辑
 
摘要: 1 public class T008 { 2 public static void main(String[] args) { 3 int[] num = { 3, 4, 5, 1, 2 }; 4 System.out.println(min(num, 5... 阅读全文
posted @ 2014-05-08 15:19 thehappyyouth 阅读(195) 评论(0) 推荐(0) 编辑
 
摘要: 1 import java.util.Stack; 2 3 public class T007 { 4 public static void main(String[] args) { 5 Queue q = new Queue(); 6 q.stack1... 阅读全文
posted @ 2014-05-08 11:17 thehappyyouth 阅读(168) 评论(0) 推荐(0) 编辑
 
摘要: 1.O(nlogk)海量数据 1 import java.util.TreeSet; 2 3 public class T030 { 4 public static void main(String[] args){ 5 int[] data = {4,5,1,6,2,7,... 阅读全文
posted @ 2014-05-08 10:23 thehappyyouth 阅读(247) 评论(0) 推荐(0) 编辑
 
摘要: 1 public class T006 { 2 public static void main(String[] args){ 3 int pre[] = {1,2,4,7,3,5,6,8}; 4 int in[] = {4,7,2,1,5,3,8,6}; ... 阅读全文
posted @ 2014-05-08 09:13 thehappyyouth 阅读(1045) 评论(0) 推荐(0) 编辑