lintry

add # 1078

/**
* @param {string} text
* @param {string} first
* @param {string} second
* @return {string[]}
*/
var findOcurrences2 = function(text, first, second) {
let target = `${first} ${second} `;
let rs = [];
while (text) {
let i = text.indexOf(target);
if (i >= 0) {
console.info(text, i);
text = text.substr(i + target.length);
console.info('==>', text);
let m = /^(\w+)\b.*/.exec(text);
if (m) {
rs.push(m[1]);
}
} else {
break;
}
}
return rs;
};
var findOcurrences = function(text, first, second) {
let words = text.split(' ');
let rs = [];
for (let i = 0; i < words.length - 2; i++) {
if (words[i] === first && words[i+1] === second && words[i+2]) {
rs.push(words[i+2]);
i++;
}
}
return rs;
};
console.info(findOcurrences("we will we will rock you", "we", "will"));
console.info(findOcurrences("alice is a good girl she is a good student", "a", "good"));
\ No newline at end of file
......@@ -1073,7 +1073,7 @@ leetcode-cn.com上的题库代码实现
| | 1072 | [按列翻转得到最大值等行数](https://leetcode-cn.com/problems/flip-columns-for-maximum-number-of-equal-rows) | **中等** |
| | 1073 | [负二进制数相加](https://leetcode-cn.com/problems/adding-two-negabinary-numbers) | **中等** |
| | 1074 | [元素和为目标值的子矩阵数量](https://leetcode-cn.com/problems/number-of-submatrices-that-sum-to-target) | **困难** |
| | 1078 | [Bigram 分词](https://leetcode-cn.com/problems/occurrences-after-bigram) | **简单** |
| 1078-findOcurrences.js | 1078 | [Bigram 分词](https://leetcode-cn.com/problems/occurrences-after-bigram) | **简单** |
| | 1079 | [活字印刷](https://leetcode-cn.com/problems/letter-tile-possibilities) | **中等** |
| | 1080 | [根到叶路径上的不足节点](https://leetcode-cn.com/problems/insufficient-nodes-in-root-to-leaf-paths) | **中等** |
| | 1081 | [不同字符的最小子序列](https://leetcode-cn.com/problems/smallest-subsequence-of-distinct-characters) | **中等** |
\ No newline at end of file
......