Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 파이썬
- Docker
- Git
- AI 경진대회
- github
- 프로그래머스
- PYTHON
- gs25
- 맥북
- SW Expert Academy
- 편스토랑 우승상품
- ubuntu
- ChatGPT
- 자연어처리
- programmers
- 우분투
- 데이콘
- 백준
- Baekjoon
- Real or Not? NLP with Disaster Tweets
- 캐치카페
- hackerrank
- 코로나19
- leetcode
- 편스토랑
- dacon
- Kaggle
- 더현대서울 맛집
- 프로그래머스 파이썬
- 금융문자분석경진대회
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 344. Reverse String (Python) 본문
728x90
반응형
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
You may assume all the characters consist of printable ascii characters.
Example 1:
Input: ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Example 2:
Input: ["H","a","n","n","a","h"]
Output: ["h","a","n","n","a","H"]
Solution
class Solution:
def reverseString(self, s):
s.reverse()
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[leetCode] 263. Ugly Number (Python) (1) | 2020.08.14 |
---|---|
[leetCode] 665. Non-decreasing Array (Python) (0) | 2020.08.13 |
[leetCode] 121. Best Time to Buy and Sell Stock (Python) (0) | 2020.08.13 |
[leetCode] 392. Is Subsequence (Python) (0) | 2020.08.13 |
[leetCode] 916. Word Subsets (Python) (0) | 2020.08.09 |
Comments