public int removeElement(int[] A, int elem) {
		// Note: The Solution object is instantiated only once and is reused by
		// each test case.
		int len = A.length;
		int i = 0, j = 0;
		for (; i < A.length; ++i, ++j) {
			if (A[i] == elem) {
				--j;
				--len;
				continue;
			}
			if (j >= 0 && A[i] != A[j]) {
				A[j] = A[i];
			}
		}
		return len;
	}