
[LeetCode] 2033. Minimum Operations to Make a Uni-Value Grid (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionYou are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-value grid is a grid where all the elements of it are equal. Return the minimum number of operations to make the grid uni-value. If it is not possible, return -1. Problem ExampleExample 1:Input: grid = [[2,4],[6,8]], x..