遍历二维数组
LC 151. Reverse Words in a String 反转字符串中的单词
https://leetcode.com/problems/reverse-words-in-a-string/
func reverseWords(s string) string { words := strings.Fields(s) slices.Reverse(words) return strings.Join(words, " ") }
原地解法
https://leetcode.com/problems/reverse-words-in-a-string/
func reverseWords(s string) string { words := strings.Fields(s) slices.Reverse(words) return strings.Join(words, " ") }
原地解法