Published
Edited
Dec 8, 2018
Insert cell
Insert cell
Insert cell
Insert cell
checksum = {
let hasTwo = 0;
let hasThree = 0;

for (let box of data) {
let counter = {}
for (const c of box) {
counter[c] = (counter[c] || 0) + 1;
}

const countSet = new Set(Object.values(counter));
if (countSet.has(2)) {
hasTwo++;
}
if (countSet.has(3)) {
hasThree++;
}
}
return hasTwo * hasThree;
}
Insert cell
Insert cell
commonLetters = {
let seen = new Set()
for (const box of data) {
for (let i = 0; i < box.length; i++) {
const substring = box.slice(0, i) + box.slice(i+1);
if (seen.has(`[${substring}, ${i}]`)) {
return substring;
}
seen.add(`[${substring}, ${i}]`);
}
}
return seen;
}
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more