[CodeFactor] Apply fixes
[ci skip] [skip ci]
This commit is contained in:
parent
69b014a718
commit
a8df503907
@ -5,7 +5,7 @@ export function compareTwoStrings(first: string, second: string) {
|
|||||||
if (first === second) return 1; // identical or empty
|
if (first === second) return 1; // identical or empty
|
||||||
if (first.length < 2 || second.length < 2) return 0; // if either is a 0-letter or 1-letter string
|
if (first.length < 2 || second.length < 2) return 0; // if either is a 0-letter or 1-letter string
|
||||||
|
|
||||||
let firstBigrams = new Map();
|
const firstBigrams = new Map();
|
||||||
for (let i = 0; i < first.length - 1; i++) {
|
for (let i = 0; i < first.length - 1; i++) {
|
||||||
const bigram = first.substring(i, i + 2);
|
const bigram = first.substring(i, i + 2);
|
||||||
const count = firstBigrams.has(bigram)
|
const count = firstBigrams.has(bigram)
|
||||||
@ -13,7 +13,7 @@ export function compareTwoStrings(first: string, second: string) {
|
|||||||
: 1;
|
: 1;
|
||||||
|
|
||||||
firstBigrams.set(bigram, count);
|
firstBigrams.set(bigram, count);
|
||||||
};
|
}
|
||||||
|
|
||||||
let intersectionSize = 0;
|
let intersectionSize = 0;
|
||||||
for (let i = 0; i < second.length - 1; i++) {
|
for (let i = 0; i < second.length - 1; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user