sir i wrote this code. it is showing correct answer after compilation but when i submit it, it shows that 3 test cases are not passed out of 10. it also shows time limit exceeded with the following message -
Dang! Your program was too slow to compute the answer to one or more test cases. Think - is there a more efficient way to arrive at the solution than brute force?
please somebody help me nd tell me what i have done wrong. my code is this -