Leetcode problem 1 solution python