October ends with a plaintive little offering from the weekly challenge . It asks us to consider the negative and liminal space just beyond the surface -- to search for what is missing; to create an order that is mysteriously irrational yet trivially banal; to contemplate what it is we yearn for. Listen to Wishing You Were Here .
Task 1: Absent Smallest Positive
The task
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.
Example 1
Input: @arr = (1, 2, 4, 5, 6)
Output: 7
Average: (1 + 2 + 4 + 5 + 6) / 5 = 3.6
We need the smallest positive integer absent from nums that is strictly greater than 3.6. The positive integers greater than 3.6 are 4, 5, 6, ...
The smallest missing one is 7.
Example 2
Input: @arr = (-5, -2, -1, 3)
Output: 1
The average is -1.25. There is a gap in the array between -1 and 3.…