๐Ÿฅž BE
home

344_Reverse String

๋‹ด๋‹น์ž
์™„๋ฃŒ ์—ฌ๋ถ€
Solved
์š”์•ฝ
๋‚ ์งœ
2024/06/25
ํƒœ๊ทธ
๊ตฌํ˜„
๋ฌธ์ž์—ด
๋‚œ์ด๋„
Easy
์ถœ์ฒ˜
LeetCode

์ฝ”๋“œ

class Solution { public void reverseString(char[] s) { int left = 0; int right = s.length -1; while (left < right) { char temp = s[left]; s[left] = s[right]; s[right] = temp; left++; right--; } } }
Java
๋ณต์‚ฌ

๋ฌธ์ œ ํ•ด๊ฒฐ ์•„์ด๋””์–ด

๋Š˜ ๋จน๋˜ swap์œผ๋กœ ์ฃผ์„ธ์š”