Sorted Matrix Problem

There may be the possibility that rows and columns are sorted in descending order then what we will do???

In ascending order, the most suitable candidates will be near to the bottom right.
Similarly in descending order, the most suitable candidates will be near to the top left.
So same approach can be applied.

in case of descending we have to create the prefix submatrix sum array but in case of ascending we will create suffix submatirx sum…is it correct???

Yes you are correct…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.