4 ms·
Parenthesis Permutation: In 7 lines of Python
- arihersh 13y agoThis is a very cool tool, @spicavigo! I look forward to using it in recruiting.
- shadykiller 13y agoHere's a 1 liner port in ruby : (l = ->(n,s=',o=0,c=0){ puts s and return if s.length == n || l.call(n,s+')',o,c+1) || o<n/2 && l.call(n,s+'(',o+1,c) if o>=c }).call(6)
- spicavigo 13y agoShame on you!