Minimum Domino Rotations for Equal Row - Leetcode 1007 - Python