1
var findLUSlength = function (strs) {2
strs.sort((a, b) => b.length - a.length);3
const isSubsequence = (a, b) => {4
const A_LENGTH = a.length;5
const B_LENGTH = b.length;6
if (A_LENGTH > B_LENGTH) return false;7
if (a === b) return true;8
const matches = [...b].reduce((pos, str) => {9
return a[pos] === str ? pos + 1 : pos;11
return matches === A_LENGTH;14
for (let a = 0; a < strs.length; a++) {15
let isUncommon = true;17
for (let b = 0; b < strs.length; b++) {18
if (a === b) continue;19
if (isSubsequence(strs[a], strs[b])) {24
if (isUncommon) return strs[a].length;