Skip to content

Instantly share code, notes, and snippets.

View tapmodo's full-sized avatar

Kelly Hallman tapmodo

  • Tapmodo Interactive LLC
  • California
View GitHub Profile
function containsExactHalvesSubarray(v) {
const hash = {}
v = v.sort((a,b) => parseInt(a)-parseInt(b));
v.forEach(i => {
if (i < 0)
if (hash[i]) hash[i][0] = true
else hash[i/2] = [null,true]
else
if (hash[i/2]) hash[i/2][1] = true
@tapmodo
tapmodo / 1-input-data.json
Created August 18, 2020 00:40
Organize a flat array of objects into a better structure (~50% smaller)
[
{
"brand": {
"name": "Antonio's Pizzeria",
"slug": "1532df73-c60f-4cca-b03d-f535e031a7e1"
},
"location": {
"id": 1,
"name": "Downtown"
},
@tapmodo
tapmodo / 1-input-data.json
Last active August 18, 2020 00:50
Organize a flat array of objects into a better structure (~50% smaller)
[
{
"brand": {
"name": "Antonio's Pizzeria",
"slug": "1532df73-c60f-4cca-b03d-f535e031a7e1"
},
"location": {
"id": 1,
"name": "Downtown"
},