/
344.cpp
35 lines (29 loc) · 986 Bytes
/
344.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
__________________________________________________________________________________________________
sample 40 ms submission
class Solution {
public:
void reverseString(vector<char>& s) {
int start = 0;
int end = s.size()-1;
while( start < end){
char ch = s[start];
s[start] = s[end];
s[end] = ch;
++start;
--end;
}
}
};
static bool _foo = ios::sync_with_stdio(false);
static ostream* _bar = cin.tie(NULL);
__________________________________________________________________________________________________
sample 15076 kb submission
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
class Solution {
public:
void reverseString(vector<char>& s)
{
std::reverse(s.begin(), s.end());
}
};
__________________________________________________________________________________________________