Help for this page

Select Code to Download


  1. or download this
    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;
    
  2. or download this
        ^ ( 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 )
    
  3. or download this
     ^ (1{7})* (?!1{7}) (1{5})* (?!1{5}) (1{1})* (?!1{1})
    
  4. or download this
    (?{ $x = $^R }) x
    
  5. or download this
     ^ ( (1{1}|1{5}|1{7}) (?{ $^R+1 }) )* 
       (?(?{ $^R < $x }) $ | x )