Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit 34fa23f

Browse files
maxbachmannaceakash
authored andcommitted
remove unrequired comparisions
1 parent e63157a commit 34fa23f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ function compareTwoStrings(first, second) {
77
first = first.replace(/\s+/g, '')
88
second = second.replace(/\s+/g, '')
99

10-
if (!first.length && !second.length) return 1; // if both are empty strings
11-
if (!first.length || !second.length) return 0; // if only one is empty string
12-
if (first === second) return 1; // identical
13-
if (first.length === 1 && second.length === 1) return 0; // both are 1-letter strings
14-
if (first.length < 2 || second.length < 2) return 0; // if either is a 1-letter string
10+
if (first === second) return 1; // identical or empty
11+
if (first.length < 2 || second.length < 2) return 0; // if either is a 0-letter or 1-letter string
1512

1613
let firstBigrams = new Map();
1714
for (let i = 0; i < first.length - 1; i++) {

0 commit comments

Comments
 (0)