public int firstMissingPositive(int[] nums) {
        int startOfPositive = segregate(nums);
        for (int i = startOfPositive; i < nums.length; i++) {
            int index = Math.abs(nums[i]) + startOfPositive - 1;
            if (index < nums.length) {
                nums[index] = -Math.abs(nums[index]);
            }
        }
        for (int i = startOfPositive; i < nums.length; i++) {
            if (nums[i] > 0) {
                return i - startOfPositive + 1;
            }
        }
        return nums.length - startOfPositive + 1;
    }
https://leetcode.com/problems/first-missing-positive/
src/com/interview/array/FirstPositiveMissing.java