leetcode medium example