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:
1 | Input: ["h","e","l","l","o"] |
Example 2:
1 | Input: ["H","a","n","n","a","h"] |
好久沒看到這麼平易近人的題目了(淚),就是反轉字串,感謝python又拯救了工程師的一天。
如果你覺得這篇文章很棒,請你不吝點讚 (゚∀゚)