/**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param numbers int整型vector 
     * @return int整型
     */
    int duplicate(vector<int>& numbers) {
        int len = numbers.size();
        int result = -1;
        for(int i = 0; i < len; i++){
            int number = numbers[i];
            // validation check
            if (number < 0 || number >= len) {
                return -1;
            }
            if (number != i) {
                if(numbers[i] == numbers[number]) {
                    result = numbers[i];
                } else {
                    numbers[i] ^= numbers[number];
                    numbers[number] ^= numbers[i];
                    numbers[i] ^= numbers[number];
                }
            }
        }
        return result;
    }