Re: Perl Quiz of the Week #23
colin.rafferty-/PgpppG8B+R7qynMiXIxWgC/[email protected]
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
Yitzchak Scott-Thoennes wrote: > That's a very strange sample order; I have a hard time picturing an > algorithm coming up with it. I'd expect "((()))()" to come after > "(()()())". Once I optimized my solution for time, I changed one detail so that I got the same order as the sample. It's interesting to see the patterns for higher Ns. paias746 $ time ~/misc/qotw/parens 12 | head (((((((((((()))))))))))) ((((((((((()())))))))))) (((((((((()(())))))))))) ((((((((()((())))))))))) (((((((()(((())))))))))) ((((((()((((())))))))))) (((((()(((((())))))))))) ((((()((((((())))))))))) (((()(((((((())))))))))) ((()((((((((())))))))))) real 0m0.05s user 0m0.01s sys 0m0.01s paias746 $ time ~/misc/qotw/parens 12 | tail ((())())()()()()()()()() (()()())()()()()()()()() ()(()())()()()()()()()() (())(())()()()()()()()() ()()(())()()()()()()()() ((()))()()()()()()()()() (()())()()()()()()()()() ()(())()()()()()()()()() (())()()()()()()()()()() ()()()()()()()()()()()() real 0m1.44s user 0m1.37s sys 0m0.02s -- Colin