Count Nice Pairs Leetcode Javascript