Two Pointers

This kind of problem is pretty interesting. Watch the video.

Problems

What about the subarray sum? The CP Handbook shows two pointer way, but I am pretty sure it doesn’t work if the array is unsorted.