BITONIC SUB-ARRAY TEST-CASE NOT PASSES

I TRIED BRUTE FORCE METHOD I GOT CORRECT OUTPUT FOR ALL CASE IN MY LAPTOP BUT NOT HAPPENING HERE
[IN LAPTOP]
2
6
12 4 78 90 45 23
5
4
40 30 20 10
4

PLEASE LOOK MY APPROACH AND SUGGEST ME
THANK YOU

@Diwyanshu
dry run your code for
2
6
12 4 78 90 45 23
8
20 4 1 2 3 4 2 10

u are getting
6
5
ans would be
5
5

mam, i changed the code please look it again …in my laptop i am getting correct output but on online ide i am not getting it

@Diwyanshu
refer to this code: