Easy for this one.
you should change the main loop to
for (int i = 0; i < k; i++)
This is to ensure you search to end of the list
and when flag is 2, also check ihttps://groups.google.com/d/msgid/google-code/3729275c-bea8-4273-8c0d-302dd383f28a%40googlegroups.com.
Can someone please help me figure out what's wrong with my code?
Link to the question:
https://codingcompetitions.withgoogle.com/codejamio/round/00050fc5/00054e9a
My approach:
Given an array, I first check with the first three elements of the array.
If they form an increasing