Minimum Common Value Leetcode Python