revised util leetcode_76