Code showing timelimit Error in test case 2? Please help me out.
Increasing Decreasing seq Problem
Hello @Ajitverma1503,
Declare t in your code.
There are few cases that you have missed, that can cause wrong errors:
- strictly increasing eg: 5 1 2 3 4 5 (wrong output)
- strictly decreasing eg: 5 5 4 3 2 1 (wrong output)
- strictly decreasing then strictly increasing eg: 3 2 1 2 3 (wrong output)
- strictly increasing then strictly decreasing eg: 1 2 3 2 1 (correct output)
for 1., 2., 3. case you should print true and
for case 4. and rest, it should print false.
Note: strictly words means equal numbers at adjacent positions would not be accepted. eg: 5 3 2 2 1 0
BTW, i submitted your code, it is not giving TLE. Checlk again.
Hope, this would help.
Give a like, if you are satisfied.
I am not able to find mistake in my code.
Hello @Ajitverma1503,
I can correct your code if you want.
But, that wont help much.
In my last reply, i have specified the testcases for which it is giving wrong outputs.
You can dry run your code or you can use cout statements to understand the flow of your code.
Let me know, if you want me to correct it.
yes Please correct it then i will known where it get wrong
Sure,
I have modified your code:
I have written the necessary comments for better understanding.
Hope, you would like.
Give a like, if you are satisfied.
thank you for modifying my code.
Anytime.
Mark this doubt as resolved, if you have no more issues regarding this question.