Code for Leetcode