문제 출처
https://leetcode.com/problems/reverse-string/
문제 설명
문자열을 뒤집는 함수를 작성하라. 입력값은 문자 배열이며, 리턴 없이 리스트 내부를 직접 조작하라.
문제 풀이
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
s = s.reverse() # 파이썬 함수 reverse() 사용
'알고리즘' 카테고리의 다른 글
[알고리즘] 배열-두 수의 합 - Jungyu Ko (0) | 2022.04.23 |
---|---|
[알고리즘] 문자열 조작-그룹 애너그램 - Jungyu Ko (0) | 2022.03.20 |
[알고리즘] 문자열 조작-가장 흔한 단어 - Jungyu Ko (0) | 2022.03.20 |
[알고리즘] 문자열조작-로그파일 재정렬 - Jungyu Ko (0) | 2022.03.20 |
[알고리즘] 문자열 조작-유효한 팰린드롬 - Jungyu Ko (0) | 2022.03.20 |