• [deleted]
    + 0 comments

    Just check the constraints in the problem statement. The algorithm is meant to solve it for a 2D array of size 4x4. Easy to generalize, just get the array dimensions and use it for iteration thresholds.