I am solving a problem where we are given a square binary grid. We have to find the number of rectangles where the number of 1's is at most k in following time complexity: O(N^2 log(N)k).
I am not able to think of any approach to this time complexity. Is it even possible and if yes how can we approach it?