leetcode: try one medium problem