LeetCode 344. Reverse String
2022.07.18
問題
https://leetcode.com/problems/reverse-string/
typescript
/**
Do not return anything, modify s in-place instead.
*/
function reverseString(s: string[]): void {
const len = s.length
for (let i =0; i < Math.ceil(len / 2); i++) {
const char = s[i]
s[i] = s[len-1-i]
s[len-1-i] = char
}
};