思路很简单, 但是自己写的代码写了一长串, 下面的代码参考了评论区的代码.
const camelMatch = function (queries, pattern) {
return queries.map(item => {
let j = 0;
for (let i = 0, ii = item.length; i < ii; ++i) {
if (pattern[j] === item[i]) {
++j;
} else if (item[i] === item[i].toUpperCase()) {
return false;
}
}
return j === pattern.length;
})
};