Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active December 7, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/41042137f44394a0094c1cc1c05055bb to your computer and use it in GitHub Desktop.
Save dogbert17/41042137f44394a0094c1cc1c05055bb to your computer and use it in GitHub Desktop.
SEGV
use v6;
my $size = 3001;
my int @mat[$size; $size];
init-array(0, $size - 1, $size * $size);
say 'done';
sub init-array($r, $c, $val) {
@mat[$r; $c] = $val;
if $c - 1 >= 0
{ # left
init-array($r, $c - 1, $val - 1);
}
elsif $r + 1 < $size
{ # down
init-array($r + 1, $c, $val - 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment