Unique characters in each string: Difference between revisions

m
Line 460:
wordCount = ws.length;
 
return sort([
...ws.slice(1).reduceRight(
(a, x) => intersect(x)(
Line 469:
]
.filter(c => wordCount === charFreqs[c])
).joinslice("");
.sort();
.join("");
})() : "";
 
Line 500 ⟶ 502:
// The intersection of two sets.
b => new Set([...a].filter(i => b.has(i)));
 
 
// sort :: Ord a => [a] -> [a]
const sort = xs =>
// An A-Z sorted copy of xs.
[...xs].slice().sort(
(a, b) => a < b ? -1 : (a > b ? 1 : 0)
);
 
 
9,655

edits