leetcode: bug fixes