Visualize the longest subarray with sum K using a sliding window. Follow the left and right pointers and see when the window expands or shrinks.
Step 0 / 13
800 ms
10
05
12
27
31
49
5- Window sum
- 0
- Target K
- 15
- Best length
- 0
Press Start to slide the window.