3 comments

[ 2.6 ms ] story [ 10.5 ms ] thread
This is a very cool tool, @spicavigo! I look forward to using it in recruiting.
Here'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)