Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #302 ("Ones and Zeros" and "Step by Step")
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, cycling every Sunday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2024-12-30 through 2025-01-05 is #302. The tasks for challenge #302 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 302-1: "Ones and Zeros" Submitted by: Mohammad Sajid Anwar You are given an array of binary strings, @str, and two integers, $x and $y. Write a script to return the size of the largest subset of @str such that there are at most $x 0’s and $y 1’s in the subset. A set m is a subset of n if all elements of m are also elements of n. Example #1: Input: @str = ("10", "0001", "111001", "1", "0") $x = 5 $y = 3 Output: 4 The largest subset with at most five 0's and three 1's: ("10", "0001", "1", "0") Example #2: Inp...