Prefix Sum + Sliding Window concept are used to reduce the time complexity to O(n^2);

Otherwise, the brute force will lead to O(n^4) solution.

Prefix Sum + Sliding Window concept are used to reduce the time complexity to O(n^2);

Otherwise, the brute force will lead to O(n^4) solution.