What will be the approach?

can’t come up with logic.

@akshitabansal321 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)

for implementation difficulties check this I’ve commented properly https://ide.codingblocks.com/s/656052

is there any other solution which do not use array? because i was thinking of some other as array topic is not covered yet. (but i have understood your solution too)

hi @akshitabansal321 yeah u can keep cnt variable and that should be equal to total no of elements