pwc

The Run-Length of Matchsticks (PWC 296)

The Run-Length of Matchsticks (PWC 296)

Challenge 296 solutions in Perl by Matthias Muth These are my Challenge 296 Task 1 and 2 solutions in Perlfor The Weekly Challenge - Perl and Raku. Summary Task 1: String CompressionDetecting runs of same characters? Regular expression!Replacing it by its run-length encoding? In the same statement!Reversing the compression as a BONUS? Even simpler! Task 2: Matchstick SquareA short solution based on a CPAN module works well for the examples and is short, but it doesn't really scale for larger sets of matchsticks.In my own implementation, a 'target sum' iterator selects groups of matchsticks that have the needed length of…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.