1. 通过参数

确切地说,通过参数列表中,引用类型的参数,本质上返回值仍只有一个,且为基本数据类型;

int foo(int n, int& x);
  • 获取一个数列中仅出现一次(奇数次)的两个数(其他数均出现 2 次(偶数次))
class Solution {
public:
    void FindNumsAppearOdds(vector<int> nums, int* num1, int* num2) {
        ....
    }       
};
posted on 2016-09-19 18:54  未雨愁眸  阅读(203)  评论(0编辑  收藏  举报