This is the link to my code.
Although my approach is the same to that of the hint video but my implementation is a bit different.
Could you help me figure out what I am doing wrong in this code
Unable to pass 2 test cases
@sankalp.sharma99
You logic is correct. But your ans might not get stored in int variable. So use long long int and change INF to 10^18. Your code will work.
1 Like