19. Subarray with given sum
My Approach
Explanation with Example
-> 1, 2, 3, 7, 5 , sum = 1
-
-> 1, 2, 3, 7, 5 , sum = 3
----
-> 1, 2, 3, 7, 5 , sum = 6
-------
-> 1, 2, 3, 7, 5 , sum = 13 here we increase staring pointer to make sum <= s
----------
-> 1, 2, 3, 7, 5 , sum = 12 here sum == s so we return our i, j values
-------Time and Auxiliary Space Complexity
Code (C++)
Contribution and Support
Last updated