@@ -0,0 +1,899 @@
+public int widthOfBinaryTree(TreeNode root) %7B%0A  if (root == null) %7B%0A    return 0;%0A  %7D%0A%0A  Queue%3CTreeNode%3E q = new LinkedList%3C%3E();%0A  Queue%3CInteger%3E indices = new LinkedList%3C%3E();%0A  q.add(root);%0A  indices.add(1);%0A  int cur = 1;%0A  int next = 0;%0A  int left = 0;%0A  int max = 0;%0A  boolean firstLeft = true;%0A%0A  while (!q.isEmpty()) %7B%0A    TreeNode node = q.poll();%0A    int index = indices.poll();%0A    cur --;%0A%0A    // First left node.%0A    if (firstLeft) %7B%0A      left = index;%0A      firstLeft = false;%0A    %7D%0A%0A    if (node.left != null) %7B%0A      q.add(node.left);%0A      columns.add(col * 2);%0A      next ++;%0A    %7D%0A%0A    if (node.right != null) %7B%0A      q.add(node.right);%0A      columns.add(col * 2 + 1);%0A      next ++;%0A    %7D%0A%0A    // Last right node.%0A    if (cur == 0) %7B%0A      cur = next;%0A      next = 0;%0A      max = Math.max(max, index + 1 - left);%0A      left = 0;%0A      firstLeft = true;%0A    %7D%0A  %7D%0A%0A  return max;%0A%7D%0A

Add 662