In Java this prints -4
int [] nums = { 2, -2, 0, 0 };
int dup = findDupe(nums);
System.out.println("dup="+dup); int [] nums = { 2, -2, 0, 0 };
int dup = findDupe(nums);
System.out.println("dup="+dup);EDIT
The given code works to find the only non-duplicate item in a list (perhaps that was what was intended)
but it is nice that people got what I said through the lines!
it should have been called findNonDupe and the var should have been called nonDup.
Hope I'll do better in a real interview ;)