lealco giving wa

getting WA …

your code seems pretty difficult to read, so just tell what’s strategy your are following ?

If I extracted test correctly then for this test:

17 9 2
15 15 16 17 16 15 15 15 15 16 15 15 15 16 17 16 16

You return 2 while the correct answer is 3.