Hi,
I gone through the solution which is provided on site for java implementation, seems complicated compared which I wrote: am I missing something?
public static void findLongestIncreasingSubarray (int[] a){
int start=0;
int end=0;
int tempStart = 0;
for (int i=1; i < a.length; i++) {
if (a[i] < a[i-1]){
if ((i-tempStart) > (end-start+1)) {
start = tempStart;
end = i-1;
}
tempStart = i;
}
}
if((a.length-tempStart) > (end-start+1)){
start = tempStart;
end = a.length-1;
}
System.out.println("Start, end : ("+start+", "+end+")");
}