Skip to content

Commit e6811ff

Browse files
committed
434/js
1 parent 5912c0d commit e6811ff

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* @lc app=leetcode id=434 lang=javascript
3+
*
4+
* [434] Number of Segments in a String
5+
*/
6+
/**
7+
* @param {string} s
8+
* @return {number}
9+
*/
10+
const countSegments = function(s) {
11+
return s.split(/\s/).filter(it => it).length
12+
}

0 commit comments

Comments
 (0)