Please give solution

Given a series of N Integers, 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 number of elements int the series.
Next N lines contain a single integer each denoting the elements of the array S.

Constraints
0 < N < 1000 Each number in sequence S is > 0 and < 1000000000

Output Format
Print boolean output - “true” or “false” defining whether the sequence is increasing - decreasing or not.

Sample Input
5
1
2
3
4
5
Sample Output
true
Explanation
Carefully read the conditions to judge which all sequences may be valid. Don’t use arrays or lists.

hi @hridyansh28_cff82018adc2f216,
the question says that you need to check if the the whole array can be partitioned somewhere such that initial numbers are increasing and remaining are decreasing

eg 1 2 3 4 9 8 7 6 can be divided into 1 2 3 4 5 9 (increasing) and 8 7 6 (decreasing)
all increasing eg 1 2 3 4 5 is also true
all decreasing eg 5 4 3 2 1 is also true
if both are there then first should be increasing then decreasing
for implementation difficulties check this I’ve commented properly

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.

in question its written dont use array or list

hi @hridyansh28_cff82018adc2f216 logic will be same try once if not tell me

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.