Skip to main content
1 of 2
Xcali
  • 16.2k
  • 2
  • 15
  • 39

Perl 5, 70 bytes

sub{map{[grep$_,map{shift@$_}reverse@_[0..$_]]}0..$#_,($#_)x$#{$_[0]}}

Try it online!

Xcali
  • 16.2k
  • 2
  • 15
  • 39