do we necessarily need to initialize these variables… bcoz
as we are not comparing them anywhere, it shoudnt bother us even if they initially have garbage value.
Initialization of left and right variables as -1
ya we need to initialize them, because there will be some cases like :-
if all numbers are negative then, it will depend on the question if in question it is stated that minimum length can be zero then we can a subarray with zero elements.
if all min len >0, then our answer will be different.
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.