I am pretty much confident about my solution, I even checked geeksforgeeks to verify my code.
Here is the link to my code.
Output is:
TESTCASE # 1 : correct (Time: 0 s)
TESTCASE # 2 : wrong-answer (Time: 0 s)
TESTCASE # 3 : wrong-answer (Time: 0 s)
Please check what might be wrong…