Error in the solution

In the hint, I have observed the usage of INT_MAX which underlies in the climits header file. Even though the program successfully compiled but in the code, there is no inclusion of climits header file.

include all the header files at once using this syntax.

#include<bits/stdc++.h>

Click here to start solving coding interview questions