发布时间:2015-03-22 16:20:14
class Change{int x;Change(int m){x=m;}}public class BalancedBinary {public static void main(String[] args) {// TODO 自动生成的方法存根TreeNode root=new TreeNode(3);//int i=3;Change change=new Change(0);System.out.print(isBalanced(root));} public static boolean isBalanced(TreeNode ro.........【阅读全文】
发布时间:2015-03-22 16:17:31
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.public ListNode rotateRight(ListNode head, int k) { &n.........【阅读全文】
发布时间:2015-03-22 14:36:00
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a c.........【阅读全文】
发布时间:2015-03-22 11:37:08
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its bottom-up level order tr.........【阅读全文】