Solve LeetCode string and list problems | Amazon Coding Question