Why my code is not giving the correct solution


my code is passing sample input but failing in some test cases

image
no need of this space before o/p