It's a well known dynamic programming problem to find the minimum sum subarray. You can use this technique in a lot of other problems too. Check out the full 100 seconds video on Dynamic Programming!
Problem suggestion and solution verification by Martin Dinev, a dear friend and an excellent competitive programmer.
---
This video has been animating with the Manim.
#100SecondsOfCode #compsi #dp
Twitter: @onedevband