The two pointers method solves “Finding Subarray with Given Sum” problem in O(N). Does the same code work for array with negative numbers ? If it doesn’t can you provide a test case for which it doesn’t work ?
The two pointers method solves “Finding Subarray with Given Sum” problem in O(N). Does the same code work for array with negative numbers ? If it doesn’t can you provide a test case for which it doesn’t work ?