Minimum Common Value Leetcode Contest Solution