Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* levelezősök
  + Adator. prog.
  + feladatsor
  + quick link

teaching assets


Félévek

* 2024/25/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

20130902e

Parentheses

Consider an expression that contains numbers, parentheses, and operators. Now we are only interested in the parentheses. Three kind of parentheses can be present: "{}", "()", "[]". If a parenthesis is opened, then it must be closed with its pair (of the same type). The scope of the parentheses cannot cross each other. Exercise: having an expression, decide if its parentheses are correct (don't bother about the numbers and operators this time).

Examples:

test("((5+3)*2+1)") == True
test("{[(3+1)+2]+}") == True
test("(3+{1-1)}") == False
test("[1+1]+(2*2)-{3/3}") == True
test("(({[(((1)-2)+3)-3]/3}-3)") == False

Tip: what data structure should we use?

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2015 June 27, 12:59