Valid Parentheses Leetcode Python Solution