Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

* Scripting Languages
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* aktuális (2023/24/2)
* 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