File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {string[]} words
3+
* @param {number[]} groups
4+
* @return {string[]}
5+
*/
6+
var getLongestSubsequence = function(words, groups) {
7+
let res = [words[0]];
8+
for (let i = 1; i < groups.length; ++i) {
9+
if (groups[i] !== groups[i - 1]) {
10+
res.push(words[i]);
11+
}
12+
}
13+
return res;
14+
};

0 commit comments

Comments
 (0)