Valid Parentheses Python Solution - LeetCode #20

preview_player
Показать описание
This is the Python solution to Valid Parentheses LeetCode problem.

Solution:

#Python #LeetCode #Coding #Programming #Algorithm #DataStructures #TechTutorial #CodeTutorial #ProblemSolving #SoftwareDevelopment #ComputerScience #CodeSnippet #ProgrammingTips #CodeChallenge #TechnicalInterview #AlgorithmDesign #SoftwareEngineering #LearnProgramming #CodingCommunity #CodeWalkthrough
Рекомендации по теме
Комментарии
Автор

Your video helped me a lot as I got cleared the concept in this video alone than others

tamilarasanpandiyan
Автор

here is the code:
stack =[]
mapping ={')':'(', ']':'[', '}':'{'}

for c in s:
if c in mapping:

if stack and stack[-1] == mapping[c]:
stack.pop()
else:
return False
else:
stack.append(c)
return not stack

tamilarasanpandiyan