Problem in code
first iterate through the whole array once and keep the note of latest point where cs=0 in k.
then again iterate through the loop but till k.
…
but how it will ensure that maximum lie only in first k ?
pls refer this thread for approach->
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.