• + 0 comments

    Here is my c++ solution, you can watch video explanation here : https://youtu.be/Z_CYzW_sQAE

    Solution 1

    vector<int> reverseArray(vector<int> a) {
      reverse(a.begin(), a.end());
      return a;
    }
    

    Solution 2

    vector<int> reverseArray(vector<int> a) {
       vector<int> result; 
        for(int i = a.size() - 1; i >= 0; i--){
            result.push_back(a[i]);
        }
        return result;
    }