Re: [闲聊] 每日leetcode

楼主: sustainer123 (caster)   2024-06-02 19:11:19
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就头尾指针吧
快乐假日
作者: DJYOSHITAKA (Evans)   2024-06-02 19:12:00
one-liner大师...
楼主: sustainer123 (caster)   2024-06-02 19:14:00
你是周赛大师 睡过头哭阿
作者: JIWP (JIWP)   2024-06-02 19:31:00
大师
作者: SecondRun (雨夜琴声)   2024-06-02 19:59:00
大师我早上按submit就炸了

Links booklink

Contact Us: admin [ a t ] ucptt.com