Help for this page
use re 'eval'; use Test::More 'no_plan'; ... is greedy_is_optimal(1,5,10,25), 1; is greedy_is_optimal(1,6,10,25), 0; is greedy_is_optimal(1,5,7), 0;
^ ( 1{7} (?{ $^R+1 }) )* (?!1{7}) ( 1{5} (?{ $^R+1 }) )* (?!1{5}) ... (?{ $x = $^R }) x | ^ ( (1{1}|1{5}|1{7}) (?{ $^R+1 }) )* (?(?{ $^R < $x }) $ | x )
^ (1{7})* (?!1{7}) (1{5})* (?!1{5}) (1{1})* (?!1{1})
(?{ $x = $^R }) x
^ ( (1{1}|1{5}|1{7}) (?{ $^R+1 }) )* (?(?{ $^R < $x }) $ | x )