Solve a medium-to-hard array manipulation problem under strict time and space complexity requirements.
Implement first_missing_positive(nums) to return the smallest positive integer absent from the input array. The algorithm must run in O(n) time and use O(1) extra space, excluding the input array. The function may modify nums in place.
nums.def first_missing_positive(nums):