Home > front end >  Please enter Java problem list algorithm (ace)
Please enter Java problem list algorithm (ace)

Time:09-15

The algorithm
 public static int findLengthOfLCIS (int [] nums) {
If (nums. Length==0)
return 0;
Int Max=0;
Int count=1;
for (int i=0; i If (nums [I] count++;
} else {
Max=Math. Max (count, Max);
Count=1;
}
}
Max=Math. Max (count, Max);
return max;
}


Instead of returning to the list of the array subscript (index) on (in case of the same length return larger index array)

CodePudding user response:

Public static List Nums maxsubIndexOfLCIS (int []) {

List Res=new ArrayList (a);

If (nums. Length & lt; 2) {
return null;
}

If (lnums. Length==2) {
If (nums [I] Res. Add (0);
Res. The add (1);
return res;
} else {
return res;
}
}
.

CodePudding user response:

No one can handle it?

CodePudding user response:

Into a javascript is also ok
  • Related