LeetCode solution , python , java