You are given an unsorted integer array A which may contain negative numbers and duplicates. Find the smallest missing positive integer. You must solve it in O(N) time and constant extra space.
This represents real-world ID allocation where smallest available ID must be assigned.