👩💻 Join our community of thousands of amazing developers!

2371. Minimize Maximum Value in a Grid You are given an m x n integer matrix grid containing distinct positive integers. You have to replace each integer in the matrix with a positive integer satisfying the following conditions: The relative order of every two elements that are in the same row or column should stay the same after the replacements. The maximum number in the matrix after the replacements should be as small as possible. The relative order stays the same if for all pairs of eleme...