rewati.raman
BAN USER[1, 3, 4, 5] =>[1, 3, 4, 6] loop runs only 1 time
[9, 8, 4, 3] =>[9, 8, 4, 4] loop runs only 1 time
[9, 9, 9, 9] =>[1, 0, 0, 0, 0] all element are parsed twice and 1 new array is created.
[0, 9, 9, 9] =>[1, 0, 0, 0] all element are parsed 1 time
[0,1,2,3] =>[1, 2, 4] all element are parsed 1 time and a new array is created.
public int[] prob1(int[] ar1) {
for(int i = (ar1.length-1);i>=0;i--){
++ar1[i];
if(ar1[i]>9) {
ar1[i]=0;
continue;
} else {
if(ar1[0]==0) {
int[] ar2 = new int[ar1.length-1];
for(int j =1;j<ar1.length;j++) {
ar2[j-1]=ar1[j];
}
return ar2;
}
return ar1;
}
}
if(ar1[0]==0) {
int[] ar2 = new int[ar1.length+1];
ar2[0]=1;
for(int i =0;i<ar1.length;i++) {
ar2[i+1]=ar1[i];
}
return ar2;
}
return ar1;
}
[1, 3, 4, 5] =>[1, 3, 4, 6]
[9, 8, 4, 3] =>[9, 8, 4, 4]
[9, 9, 9, 9] =>[1, 0, 0, 0, 0]
[0, 9, 9, 9] =>[1, 0, 0, 0]
[0,1,2,3] =>[1, 2, 4]
Repcharlespladd, Android Engineer at Abs india pvt. ltd.
I am Charles from Pascoag USA. I have strong knowledge of pain management systems. And I have experience in providing ...
is the question correct
- rewati.raman September 10, 2015( + 7 ( * 8 12 ) ( * 2 (+ 9 4) 7 ) 3 )
should be
( ++7 ( * 8 12 ) ( ** 2 (+ 9 4) 7 ) 3 )
right???