Help needed for FLOW017

here is the problem link:https://www.codechef.com/problems/FLOW017
my solution link : https://www.codechef.com/viewsolution/48521933
for this problem I tried using max and min functions instead of ‘if else’. It is giving the same output when I run it but when I submit it, it is wrong.
can someone please help me fix this…thanks in advance.

Consider the test input:

1                    
1 3 2
1 Like

As per your code if b>a and b>c res1=b and res2 also equals b and hence when you take the min of res1 and res2 you still get b which is the maximum element.

1 Like

thanks…got it

1 Like