Algorithm/leetcode(python)(4)