Get Minimum Moves Leetcode Python