2015年3月26日

Rotate Array II

摘要: Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to come... 阅读全文

posted @ 2015-03-26 11:58 Step-BY-Step 阅读(177) 评论(0) 推荐(0) 编辑

Reverse Bits

摘要: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ... 阅读全文

posted @ 2015-03-26 11:13 Step-BY-Step 阅读(133) 评论(0) 推荐(0) 编辑

override toString() function for TreeNode to output OJ's Binary Tree Serialization

摘要: 1 class TreeNode { 2 int val; 3 TreeNode left; 4 TreeNode right; 5 TreeNode(int x) { val = x; } 6 7 @Override 8... 阅读全文

posted @ 2015-03-26 10:38 Step-BY-Step 阅读(330) 评论(0) 推荐(0) 编辑

Construct BST from given preorder traversal

摘要: Given preorder traversal of a binary search tree, construct the BST.For example, if the given traversal is {10, 5, 1, 7, 40, 50}, then the output shou... 阅读全文

posted @ 2015-03-26 10:34 Step-BY-Step 阅读(282) 评论(0) 推荐(0) 编辑

autoboxing and unboxing

摘要: Why does 128==128 return false but 127==127 return true 1 public static void autoboxingUnboxing(){ 2 Integer ta = 127; 3 Integer tb =... 阅读全文

posted @ 2015-03-26 00:24 Step-BY-Step 阅读(195) 评论(0) 推荐(0) 编辑

导航