Algorithm/CPP
[C++/LeetCode/Top Interview Questions]String
문제 1. Reverse String class Solution { public: void reverseString(vector& s) { reverse(s.begin(), s.end()); } }; vector에는 reverse(start, end) 함수가 있으니까 사용하면 된다. 문제 2. Reverse Integer class Solution { public: int reverse(int x) { string str_x = to_string(x); string rev_str_x; for (int i=str_x.size()-1; i>-1; i--) rev_str_x += str_x[i]; long long res = stoll(rev_str_x); if (x < 0) res *= -1; return ..