following the brute force approach but it confuses in making sub arrays
try to do auxiliary approach but can’t understand
please help with a explanation.
following the brute force approach but it confuses in making sub arrays
try to do auxiliary approach but can’t understand
please help with a explanation.
first, you initialise a maxlen as 1 since 1 is the minimum possible answer
now u start a while loop for i=0 to n
first calculate the continuous ascent
followed by the descent
now u have to start from the last element of the descent
and at the end of each iteration update the maxlen
why this works in O(n) is simple if a[j] > a[j+1] it cannot simultaneously be a part of another biotonic string as a[j]<a[j+1] since that is contradictory so, only one pass is enough
if your doubt is solved kindly mark it as resolved
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.