G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 4th, 2020 142 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     def isValid(self, s: str) -> bool:
  2.         brackets = {
  3.             "}": "{",
  4.             ")": "(",
  5.             "]": "[",
  6.         }
  7.         control = []
  8.         if not s:
  9.             return True
  10.         size = len(s)
  11.         if size % 2:
  12.             return False
  13.         for b in s:
  14.             if b in "({[":
  15.                 control.append(b)
  16.             if b in ")]}":
  17.                 try:
  18.                     if control[-1] == brackets[b]:
  19.                         control.pop()
  20.                     else:
  21.                         return False
  22.                 except IndexError:
  23.                     return False
  24.         if len(control) == 0:
  25.             return True
  26.         return False
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top