[Golang][Leetcode][String]刷題系列-344-Reverse String

Contents
344. Reverse String
Level : Easy
原題連結 : Click
題目 :
Write a function that reverses a string. The input string is given as an array of characters s.
Example :
Note
Input: s = [“h”,“e”,“l”,“l”,“o”]
Output: [“o”,“l”,“l”,“e”,“h”]
Input: s = [“H”,“a”,“n”,“n”,“a”,“h”]
Output: [“h”,“a”,“n”,“n”,“a”,“H”]
解題思路 :
- 作為string系列的第一題,來個簡單的暖暖身吧!
- 直接使用golang的語法糖輕鬆解決這題!
以下是我的解法 - time complexity: O(n) , space complexity: O(1)
|
|
最後祝福努力認真的各位 “All your dream of are hidden in your daily life” 我們峰頂見!!!