public int firstMissingPositive(int[] A) {
		// Start typing your Java solution below
		// DO NOT write main() function
		if (A.length == 0) {// if A is empty, that means '1' is the missing
							// positive
			return 1;
		}

		for (int i = 0; i < A.length; i++) {
			if (A[i] > 0 && (A[i] - 1 < A.length) && A[A[i] - 1] != A[i]) {
				int temp = A[A[i] - 1];
				A[A[i] - 1] = A[i];
				A[i] = temp;
				i--;//continue doing A[i]
			}
		}

		int j = 1;

		while (j <= A.length && A[j - 1] == j) {
			j++;
		}
		return j;

	}