Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

valid paranthesis

    def isValid(self, s: str) -> bool:
        if len(s)&1!=0:
            return False
        q=deque()
        for i in s:
            if i=='(' or i=='{' or i=='[':
                q.append(i)
            elif len(q)!=0 and ((q[-1]=='(' and i==')') or (q[-1]=='[' and i==']') or (q[-1]=='{' and i=='}')):
                q.pop()
            else:
                return False
        if len(q)==0:
            return True
        return False
Comment

PREVIOUS NEXT
Code Example
Python :: list python !g 
Python :: python special methods list 
Python :: python to dart converter 
Python :: manager.dict() append 
Python :: beautifulsoup - extracting link, text, and title within child div 
Python :: XML to table form in Excel 
Python :: comprehension 
Python :: if is 
Python :: create multiple marks python for python 
Python :: pandas groupby min get index 
Python :: get_type_display 
Python :: find sum of all elements in a matrix by python 
Python :: Flask_SQLAlchemy is claiming my value is not boolean 
Python :: how to map url with usernames prefixed 
Python :: pandas combine bool columns 
Python :: KeyError: 0 python 
Python :: postgres fecth python 
Python :: ring convert string lines to list items and convert the list to a string 
Python :: text to ascii art generator python 
Python :: how to insert a character into a string in python 
Python :: search for file in a whole system 
Python :: insertar valor python 
Python :: how to use random ranint 
Python :: pip is not recognized as an internal or external command 
Python :: Rebinding a list stored in a Flask Session 
Python :: how to resolve This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem. in thread python 
Python :: python loop over lists 
Python :: grid_data=d.iloc[index].as_matrix( ).reshape(28,28) not working 
Python :: print start time in python 
Python :: python long numbers as string 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =