please tell what is wrong in the code as 1 testcase is displaying wrong answer
Here is my code-
1 test case getting failed
Hello @pragyachoudhary1111,
-
It is producing wrong answer for all the three test cases.
It will not even pass the sample test case.
Reason:
You have not taken into account the value of T.
Solution:
Read the question properly.
Modified code:
https://ide.codingblocks.com/s/165759 -
Even after correcting the code it is facing TLE (time limit exceeded) for bigger values.
Solution:
Use binary search to reduce the time complexity.
Hope, this would help.
Give a like if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.