my own code in leetcode OJ