Maximum length Biotonic Subarray

wrong output is coming, what is the mistake ?

Hello @vipin.kumar,

  1. The way you are trying to initialize the arrays inc and dec with 1 is logically wrong.

  2. The logic for computing the values of inc an dec is also wrong.

I have modified your code:

Hope, this would help.
Give a like if you are satisfied.

1 Like