[Neworleans-pm] Fwd: Perl Quiz of the Week #23

E. Strade, B.D. estrabd at yahoo.com
Wed Sep 1 13:43:07 CDT 2004




=====
http://www.brettsbsd.net/~estrabd

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

----- Original message -----
From: "Mark Jason Dominus" <mjd at plover.com>
To: perl-qotw at plover.com
Date: Wed, 01 Sep 2004 12:50:14 -0400
Subject: Perl Quiz of the Week #23



IMPORTANT: Please do not post solutions, hints, or other spoilers
        until at least 60 hours after the date of this message.
        Thanks.

IMPORTANT: S'il vous plaît, attendez au minimum 60 heures après la
        date de ce message avant de poster solutions, indices ou autres
        révélations. Merci.

WICHTIG: Bitte schicken Sie keine Lösungen, Tipps oder Hinweise für
        diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser
        Mail. Danke.


----------------------------------------------------------------


Write a program, 'parens', which gets a command line argument, n',
which is an integer.  The program should print all the
properly-balanced strings of parentheses of length 2n.  For example,
given the argument '3', the program should print these five lines:

        ((()))
        (()())
        (())()
        ()(())
        ()()()

in some order.  (The order is not important.)  

For the argument '1'; the output should be:
        
        ()

and for argument '4', the output should be:

        (((())))
        ((()()))
        ((())())
        ((()))()
        (()(()))
        (()()())
        (()())()
        (())(())
        (())()()
        ()((()))
        ()(()())
        ()(())()
        ()()(())
        ()()()()

in some order.

[ ADMIN: I'm still hoping someone will step forward to write a report
  about expert quiz #22.  - MJD ]




More information about the NewOrleans-pm mailing list