Please detect problem in my code
Pointer Problem
@Lovishbansal
Just initialize ans with LLONG_MAX inplace of INT_MAX. INT_MAX is not the optimal upper bound given the constraints.
If my answer was able to answer your query, please mark the doubt as resolved.