Minimum Common Value Leetcode Javascript Problems