challenges

my solutions to various "programming challenge" problems
git clone https://wehaveforgeathome.hates.computer/challenges.git
Log | Files | Refs | LICENSE

015.pl (254B)


      1 #!/usr/bin/perl
      2 
      3 use strict;
      4 use warnings;
      5 use Memoize;
      6 
      7 memoize('paths');
      8 
      9 print paths(20, 0, 0) . "\n";
     10 
     11 sub paths {
     12   my ($size, $x, $y) = @_;
     13   return 1 if ($x == $size || $y == $size);
     14   return paths($size, $x + 1, $y) + paths($size, $x, $y + 1);
     15 }