Codes for Leetcode problems, tested by Leetcode OJ