solve a leetcode problem