Not able to get the logic of it

Given an array S of size N , check if it is possible to split sequence into two sequences -
s1 to si and si to sN such that first sequence is strictly decreasing and second is strictly increasing. Print true/false as output.

Input Format
First line contains a single integer N denoting the size of the input.
Next N lines contain a single integer each denoting the elements of the array S.

LOGIC:
once sequence is increasing then it can’t be decreasing

CHECK OUT THIS

if you have any doubt feel free to ask

i didnt get he 15 line why we have written prev=cureent plz explain

for next iteration current element will be prev element

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.

1 Like