TLE in "Second Largest " (FLOW017)

Can Anybody Please help Me with a Solution i am getting TLE For this Problem !

Problem Solution Link :CodeChef: Practical coding for everyone

@lucky_guy
U missed out two more conditions
else if(b > c and b < a)
cout << b << endl;
else if(a < b and a > c)
cout << a << endl;
add these two.

1 Like

@lost_boy12 Thanks For helping brother was stuck in this problem for a long time

1 Like

my pleasure :grin: :grin:

Can you suggest any tutorials for improving data structures and algorithm

Geeksforgeeks for tutorials and
codechef,codeforces,atcoder for practice

1 Like

Thanks bro

I am recieving a RUNTIME ERROR(SIGPE) in FLOW016 problem .Can you tell me what is the problem with my solution…

My solution is : CodeChef: Practical coding for everyone

@lucky_guy
change gcd condition in your solution
if(b is zero)
return a;
because when a becomes zero
gcd(b,a%b)
=>gcd(b,0%b)
=>gcd(b,0)
here second parameter becomes zero so your condition (if a = 0) return b is already
been checked here so you need not check that one explicitly whereas b = 0 case is not covered in your solution.

Thanks bro for helping

1 Like