Sir i am not getting logic

for increasing decreasing sequence question without using arrys and list

Try to come up with some brute force solution and tell me.
I will tell you the correct approach after that.

Sir I don’t know about brute Force technique

We just have to display true or false: if we can divide the array in two parts - first is strictly decreasing and second is strictly increasing.
For doing this question without using arrays or lists,

  1. Store first element of the array in a variable “start”.
  2. Also take a variable “x” which tells you which part of the array you are currently in - the first part or the second part.
  3. Start taking inputs for the remaining n-1 elements and at each step, compare it with the variable start according to the value of x.
    For example, lets say our initial value of x is 0.
    When x=0, we are in the first part of our array and it should be strictly decreasing. So input number < start
    And when x=1, we are in the second part of our array and it should be strictly increasing. So input number > start.
  4. We also update values of start to the current number if our condition is true. And if any point there is a mismatch, we simply display false.
  5. And in the end if we do not find any conflict, we display true.

Try and code this approach and tell me if you are able to do so.

Sir but we have to do this without using array even I don’t study about array till now

I am not using array in the approach which I have explained to you

@rakesh800650 Please mark your doubt as resolved if you are satisfied.

Sir still I am not able to write code for the problem

Just follow the above algorithm step by step. And you will be able to code it.

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.