Robbie Hatley’s Solutions, in Perl, for The Weekly Challenge #397 (“Absent Smallest Positive” and “Binary Reflection”)
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2026-10-26 through 2026-11-01 is #397. The tasks for challenge #397 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 397-1: Absent Smallest Positive Submitted by: Mohammad Sajid Anwar You are given an array of integers. Write a script to return the smallest absent positive integer such that it is strictly greater than the average of all elements in the given array. I first hash the input array @$aref to %hash, then store it's average in $avg. I then set a variable $asp to the floor of $avg plus 1, or to 1, whichever is greater. I then repeatedly increment $asp for so long as $asp is in %hash. Then I simply return $asp. That yields "the smallest positive integer which is strictly-greater than the average o...