leetcode : reverse string

심현덕·2022년 5월 20일
0

코딩 테스트

목록 보기
3/6

Write a function that reverses a string. The input string is given as an array of characters s.

You must do this by modifying the input array in-place with O(1) extra memory.

단순히 문자열을 뒤집는 문제입니다.
파이썬이기 때문에 아주 간단한 문제입니다.

1.string이지만, s는 문자가 들어간 리스트입니다.
2.순서를 역순으로 바꿉니다.

코드를 입력하세요
class Solution:
    def reverseString(self, s: List[str]) -> None:
        """
        Do not return anything, modify s in-place instead.
        """
        s.reverse()

한줄이면 댑니다.👍

profile
심현덕이에요

0개의 댓글