We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3f18e1 commit 1a4bec6Copy full SHA for 1a4bec6
151.data
@@ -0,0 +1,3 @@
1
+"the sky is blue"
2
+" hello world! "
3
+"a good example"
151.翻转字符串里的单词.js
@@ -0,0 +1,21 @@
+/*
+ * @lc app=leetcode.cn id=151 lang=javascript
+ *
4
+ * [151] 翻转字符串里的单词
5
6
+ * 1. 正则匹配分词
7
+ * 2. 去掉空单词
8
+ * 3. 顺序翻转
9
+ * 4. 拼接单词
10
+ */
11
+
12
+// @lc code=start
13
+/**
14
+ * @param {string} s
15
+ * @return {string}
16
17
+var reverseWords = function(s) {
18
+ return s.split(/[ ]+/).filter(word => word).reverse().join(' ');
19
+};
20
+// @lc code=end
21
0 commit comments