Re: [閒聊] 每日leetcode已回收
看板Marginalman作者sustainer123 (caster )時間1年前 (2024/06/02 19:11)推噓3(3推 0噓 2→)留言5則, 4人參與討論串310/1554 (看更多)
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
推
06/02 19:12,
1年前
, 1F
06/02 19:12, 1F
→
06/02 19:14,
1年前
, 2F
06/02 19:14, 2F
推
06/02 19:31,
1年前
, 3F
06/02 19:31, 3F
推
06/02 19:59,
1年前
, 4F
06/02 19:59, 4F
→
06/02 20:00,
1年前
, 5F
06/02 20:00, 5F
討論串 (同標題文章)
完整討論串 (本文為第 310 之 1554 篇):