Hi, I am unable to solve for all test case, Please help me out https://ide.codingblocks.com/s/80305
Increasing Decreasing Sequence Problem Test Cases
Check if your code is giving “True” as output for the below three conditions:
- Frst decreasing then increasing.
- Completely decreasing.
- Completely increasing.
If you it is still face problem… Then let me know
hey,
In the same problem 2nd test case is showing wrong answer. i would be really glad if you could help.
for(j=0;j<temp;j++){
if(a[j]<a[j+1]){
cout << “false”;
break;
}
}
i was wondering if this would ever execute? think.
and run your code for: 5 5 4 3 2 1
it will help you to figure out your mistake.
what should be the value of temp before third loop and what is it actually? think.
hopefully, this would help.
Hi Sir, have checked the code for these three conditions it return true for all these test cases.
“First decreasing then increasing.”
“Completely decreasing.”
“Completely increasing.”
now, check for this
5
5
4 //focus here
4 //
3
4
Hint: a strictly increasing or strictly decreasing function does not contain equal values.
solve this issue, and your code will pass all the test cases.
the code return false for the 5 5 4 4 3 4
unable to figure out where the actual issue lies, Please help
@Shobhit-Sharma-1473370192798371 Check, again.
Your code is returning true for 5 5 4 4 3 4
I just executed it on this input and it is returning true
Sir, this is the url of my code “https://ide.codingblocks.com/s/80305” and this is the response that I am getting this reponse, I guess you might be referring to wrong url.
I hope this is not frustrating you that instead of sharing the correct code, I am just pointing out ur mistakes again and again.
But trust me, these learnings will help you in future.
Try to run it for:
5
1
2
3
2
1
The answer should be false
Suggestion:
- Next time, Run your code for all possible inputs.
- Understand the question and Try to think of all possible kind of inputs for your problem.
For this problem:
- decreasing then increasing : true
- Decreasing : true
- Increasing : true
- Single input (example: 1 5) : true
- Increasing then decreasing : false
- Same values at consecutive places : false
Feel free to ask again