This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const d4p2 = data => { | |
| const getObj = passport => passport | |
| .split(/[^a-z0-9:#]/) | |
| .reduce((acc, str) => { | |
| const splitString = str.split(':'); | |
| acc[splitString[0]] = splitString[1]; | |
| return acc; | |
| }, {}); | |
| const validate = ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let d1p1 = x => x.map((e,i,a) => { | |
| return a.map((e2, i2) => { | |
| if (i === i2) return; | |
| if (e + e2 === 2020) { | |
| return e * e2; | |
| } | |
| return; | |
| }).find(Number); | |
| }).find(Number); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Day 1a | |
| with open("../Downloads/input.txt") as f: | |
| lines = f.readlines() | |
| did_increase = 0 | |
| for idx, i in enumerate(lines): | |
| if idx > 0 and int(lines[idx]) > int(lines[idx - 1]): | |
| did_increase += 1 |