educative.io

Prefix sums pattern

The solution doesn’t mention a more optimal prefix sum approach.

Also, prefix sum might be a pattern by itself, however, it is not mentioned in the course so far.