class Solution {
public void reverseString(char[] s) {
int i = 0;
int j = s.length - 1;
while(i < j) {
char tmp = s[j];
s[j] = s[i];
s[i] = tmp;
i++;
j--;
}
}
}
'JAVA > leetcode' 카테고리의 다른 글
[LeetCode] Two Sum II - Two Pointer (0) | 2021.08.09 |
---|---|
[LeetCode] Array Partition I (0) | 2021.08.09 |
[LeetCode] Pascal's Triangle (0) | 2021.08.08 |
[LeetCode] Two Sum (0) | 2021.08.07 |
[LeetCode Medium] Spiral Matrix !! - BFS (0) | 2021.08.06 |