static TreeNode genTree(char[] tree){
		if(tree.length == 0) return null;
		ArrayList<TreeNode> nodes = new ArrayList<TreeNode>(20);
		for(int i = 0; i < tree.length; i++){
			if(tree[i] == '#') nodes.add(null);
			else{
				TreeNode node = new TreeNode(tree[i]-'0');
				nodes.add(node);
			}
		}
//		System.out.println(nodes.toString());
		
		for(int i = 0; i< tree.length; i++){
//			System.out.println("i" + i);
			TreeNode n = nodes.get(i);
//			System.out.println(n);
			if(n == null) continue;
			int l = 2*i + 1;
			int r = 2*i + 2;
			if(l<tree.length && nodes.get(l) != null){
//				System.out.println("left " + l );
				n.left = nodes.get(l);
			}
			if(r<tree.length && nodes.get(r) != null){
				
				n.right = nodes.get(r);
//				System.out.println("right : " + n.right );
			}
		}
		//printTree(nodes.get(0));
		return nodes.get(0);
	}