Minimum provisioning step
Your task
A platform team writes a capacity plan, one row per week. In week i the fleet has to run at least min_nodes[i] machines to hold the error budget and at most max_nodes[i] machines to hold the cost budget, and every row is valid, so a floor never exceeds its own ceiling. Provisioning limits how far the count may move between neighbouring weeks: a plan is buildable at step s when any two consecutive counts differ by at most s. Return the smallest step that admits at least one plan honouring every week's floor and ceiling. Return 0 for a plan shorter than two weeks. Comparing neighbouring rows alone is not enough, because a roomy row in the middle still has to be crossed in one direction.
Examples
smallest_fleet_step(min_nodes: list[int], max_nodes: list[int]) -> intExample 1
Input
smallest_fleet_step([4, 4, 12], [4, 30, 12])Output
4Example 2
Input
smallest_fleet_step([6, 2, 9], [10, 20, 14])Output
0Example 3
Input
smallest_fleet_step([0, 0, 10], [0, 100, 10])Output
5