leetcode 75 solution in c