Hacker News new | ask | show | jobs
by zucker42 2501 days ago
Brute is choosing every index pair (n^2) and calculating the sun of their subarray (n). With prefix sums you can get to n^2.