We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da18d19 commit 4ebab0dCopy full SHA for 4ebab0d
README.md
@@ -29,6 +29,7 @@ since 2021.10.10 / Benben
29
- 0028.Implement strStr()
30
- 0035.Search Insert Position
31
- 0053.Maximum SubArray
32
+- 0058.Length of Last Word
33
- 0104.Maximum Depth of Binary Tree
34
- 0100.Same Tree
35
- 0110.Balanced Binary Tree
leetcode-easy/0058-length-of-last-word.js
@@ -0,0 +1,12 @@
1
+/**
2
+ * @param {string} s
3
+ * @return {number}
4
+ */
5
+var lengthOfLastWord = function(s) {
6
+ const arr = s.trim().split(' ')
7
+ return arr[arr.length - 1].length
8
+};
9
+
10
+// 2022/06/13 done
11
+// Runtime: 61 ms, faster than 90.52% of JavaScript online submissions for Length of Last Word.
12
+// Memory Usage: 42.5 MB, less than 9.29% of JavaScript online submissions for Length of Last Word.
0 commit comments