Https://www.codechef.com/viewsolution/37943073

https://www.codechef.com/viewsolution/37943073

i don’t why 1st and 2nd test cases are giving WA…is the logic right???

Mistake on line 12 and 26 ,it should be <= instead of <

Try this case :
3 2
0 1 2
2 3

Reason : Your for loop in both of the findmin and findmax functions will run from [0, size). You have done it for [0, size-1).

thanks bro for the help!! a silly mistake :stuck_out_tongue:

1 Like

thank you bro for the help!!