josearturodelosangeles
BAN USERyes, i think is like that, except, any consecutive numbers (any numbers next to each other), not necessarily repeated ones
- josearturodelosangeles June 02, 2016It must have been 3 curly braces, sorry.
static int[] increment(int[] a )
{
int sum = 1;
int p = 0;
for(int i= a.length-1; i>=0; i--)
{
sum = sum+a[i]*(int)Math.pow(10,p);
p++;
}
p--;
System.out.format("%n %d %n %d ",sum,p);
for(int j = 0; j<a.length;j++)
{
int entre = (int)Math.pow(10, p);
System.out.format("--entre %d sum %d %n",entre, sum );
int temp = sum/ entre;
a[j]= temp;
int rem = sum%entre;
System.out.format("reminder %d ",rem);
sum = rem;
System.out.format("temp %d %n",temp);
p--;
}
System.out.format("%s %n",Arrays.toString(a));
return a;
}
the question asks for a Valid Binary Tree, not a valid Binary Search Tree, so, the min max should not be a concern, rather whether the tree has two children per node at most.
- josearturodelosangeles October 05, 2016