发布时间:2015-03-22 16:48:37
//A message containing letters from A-Z is being encoded to numbers using the following mapping:////'A' -> 1//'B' -> 2//...//'Z' -> 26//Given an encoded message containing digits, determine the total number of ways to decode it.////For example,//Given encoded message "12.........【阅读全文】
发布时间:2015-03-22 16:44:57
public class compareVersion {public static void main(String[] args) {// TODO 自动生成的方法存根}public int compareVersion(String version1, String version2) { int flag1[]=new int[version1.length()+1]; int flag2[]=new int[version2.length(.........【阅读全文】
发布时间: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.........【阅读全文】