作者sustainer123 (caster )
看板Marginalman
標題Re: [閒聊] 每日leetcode
時間Sun Jun 2 19:11:19 2024
https://leetcode.com/problems/reverse-string
344. Reverse String
如題
Example 1:
Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Example 2:
Input: s = ["H","a","n","n","a","h"]
Output: ["h","a","n","n","a","H"]
Python Code:
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
s.reverse()
不用reverse就頭尾指針吧
快樂假日
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.48.144 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1717326692.A.693.html
推 DJYOSHITAKA: one-liner大師... 06/02 19:12
→ sustainer123: 你是周賽大師 睡過頭哭阿 06/02 19:14
推 JIWP: 大師 06/02 19:31
推 SecondRun: 大師 06/02 19:59
→ SecondRun: 我早上按submit就炸了 06/02 20:00