for Robot Artificial Inteligence

12. Reverse String

|

class Solution {
public:
    void reverseString(vector<char>& s) {
        vector<char> copy;
        for(char i : s)
        {
            copy.insert(copy.begin(), i);
        }
        s = copy;

    }
};

Comments