Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Ooh, that is quite elegant indeed. One of my lessons here was "Know in which order thine regex engine tries things" but I completely missed this little optimization. ;) It really matches up temporaly with the spirit of the problem.
I suppose I could also use (?>pattern) to prevent backtracking and perform the greedy match without the negative lookaheads? Although I can't say I've ever really used (?>pattern)... Anyway, the pain in the butt is counting the number of coins. I like my little (?{$^R+1}) idiom! blokhead In reply to Re^2: The greedy change-making problem using regexes
by blokhead
|
|