Your question is Min First Half Max Second Half. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Alten telemetry processing separates each sensor reading window into two segments. Write a function that returns the minimum value from the first half of nums and the maximum value from the second half.
For an array of length n, define the halves as follows:
0 through n // 2 - 1n // 2 through n - 1For odd-length arrays, the middle element belongs to the second half.
Implement half_extremes(nums).
nums, a list of integers with at least two elements.[first_half_minimum, second_half_maximum].Do not sort the array. A single pass over each half is sufficient.
def half_extremes(nums):