Robbie Hatley's Perl Solutions To The Weekly Challenge #201
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle, usually with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-01-22 through 2023-01-28) is weekly challenge #201. For a change, I was the "submitted by" person for challenge #2 (M. Anwar submitted #1). Challenge #1 is: "Given an array of unique integers, write a script to find out all missing integers in the range 0..$n where $n is the array size." This is simple, but quirky, because the results may not quite be what one expects. For example, given the sequence (14, 15, 18, 19) -- or, for that matter, (18, 14, 19, 15) -- one might expect the "missing numbers" to be (16, 17). But nope, they'll be (0, 1, 2, 3). A more-useful script might be to find all missing integers in the range $min..$max rather than 0..$size. So I wrote a script to do both, the main body of which looks like this: my $size = scalar @ARG