leetcode python solution