Question DSA-TP-0072
HardWhy can't the variable-size sliding window solve 'smallest subarray with sum ≥ S' when negative numbers are allowed?
- A.
It still works
- B.
Adding an element may decrease the sum, so shrinking/growing decisions are no longer monotonic
- C.
Sign up free to see the answer and a step-by-step explanation.