We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1c73e49 commit 6bda381Copy full SHA for 6bda381
3309-count-prefix-and-suffix-pairs-i/3309-count-prefix-and-suffix-pairs-i.js
@@ -7,10 +7,9 @@ var countPrefixSuffixPairs = function(words) {
7
const isPrefixAndSuffix = (word1, word2) => {
8
const wordOneLen = word1.length;
9
const wordTwoLen = word2.length;
10
- const isPrefix = () => word1 === word2.slice(0, wordOneLen);
11
- const isSuffix = () => word1 === word2.slice(wordTwoLen-wordOneLen);
12
- if (isPrefix() && isSuffix()) return true;
13
- return false;
+ const isPrefix = word1 === word2.slice(0, wordOneLen);
+ const isSuffix = word1 === word2.slice(wordTwoLen-wordOneLen);
+ return isPrefix && isSuffix;
14
}
15
for (let i = 0; i < words.length; i++) {
16
for (let j = i+1; j < words.length; j++) {
0 commit comments