This longest subarray with sum k, solution given in the video not passing this test case. pls find link in description
hello @pranjalsoni
yeah the implementation in video is bit wrong.
in place of else.
it should be
reason is simple-> we insert index in our map only when key corresponding to pre dont exist.
1 Like
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.