Skip to content

Commit ed9dd73

Browse files
Merge pull request #19 from marcelblijleven/new-solutions
New solutions
2 parents 2b8a930 + b44285a commit ed9dd73

File tree

10 files changed

+395
-38
lines changed

10 files changed

+395
-38
lines changed

.versionrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"section": "🛠 Improvements"
4545
},
4646
{
47-
"hidden": false,
47+
"hidden": true,
4848
"type": "docs",
4949
"section": "📄 Documentation"
5050
},

CHANGELOG.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,6 @@ All notable changes to this project will be documented in this file. See [standa
5959
* improve test coverage for 2015 ([d2dbbe7](https://github.com/marcelblijleven/adventofcode/commit/d2dbbe7c2a53c6709d2449317d4596d17cbd1e30))
6060

6161

62-
### 📄 Documentation
63-
64-
* update README ([f11ce84](https://github.com/marcelblijleven/adventofcode/commit/f11ce84b58fc765d12d0bb47477085c1f2333060))
65-
* update README ([53769d4](https://github.com/marcelblijleven/adventofcode/commit/53769d4787bcbb5ac3e5372034c790ae09685839))
66-
* update README ([1a8cdcf](https://github.com/marcelblijleven/adventofcode/commit/1a8cdcfa94b89ad5f90ec0ae48a4f3450f4bb513))
67-
* update README ([551d6a4](https://github.com/marcelblijleven/adventofcode/commit/551d6a4f71f0cf6732cf9fa5dcaeaf1afbe0a7c1))
68-
* update README ([e3f1b49](https://github.com/marcelblijleven/adventofcode/commit/e3f1b49a93aebc4accce234d719bd07b2482d7d6))
69-
* update README ([b478d35](https://github.com/marcelblijleven/adventofcode/commit/b478d351666c61e5bffeb7b33ff8a55f48ad1bd4))
70-
* update README ([cec185c](https://github.com/marcelblijleven/adventofcode/commit/cec185c446e7a407b7250120ef8fba0c611ef27e))
71-
* update README ([b18ff6b](https://github.com/marcelblijleven/adventofcode/commit/b18ff6b62c70ce986e358f73e2f48ecc0213c90b))
72-
7362
### [1.3.2](https://github.com/marcelblijleven/adventofcode/compare/v1.3.1...v1.3.2) (2021-12-01)
7463

7564

@@ -84,11 +73,6 @@ All notable changes to this project will be documented in this file. See [standa
8473
* update test with new shop inventory ([b94620e](https://github.com/marcelblijleven/adventofcode/commit/b94620ed5c91d91e5b7c20f9861042c1200bcd44))
8574

8675

87-
### 📄 Documentation
88-
89-
* update README ([fa50425](https://github.com/marcelblijleven/adventofcode/commit/fa50425638de6ee79b1ec72ab09a26c9d712129e))
90-
91-
9276
### 🐛 Bug Fixes
9377

9478
* display correct amount of microseconds in solution timer ([7a46063](https://github.com/marcelblijleven/adventofcode/commit/7a4606342cbb30b669c88231386622019bf84737))
@@ -108,12 +92,6 @@ All notable changes to this project will be documented in this file. See [standa
10892
* remove empty hand option to solve 2015 day 21 part two ([5e6e227](https://github.com/marcelblijleven/adventofcode/commit/5e6e227cccbe1ac91d9cd4bf2f21c66621d883f6))
10993

11094

111-
### 📄 Documentation
112-
113-
* update README ([bd4e08b](https://github.com/marcelblijleven/adventofcode/commit/bd4e08baa4dc6d7b855fc7e9862ce5625ea1b8b6))
114-
* update README ([10226eb](https://github.com/marcelblijleven/adventofcode/commit/10226eb02a8eee5bbc84b1407c34e166ae44e8ea))
115-
* update README ([13cbb48](https://github.com/marcelblijleven/adventofcode/commit/13cbb485f5a0f55a7e5de9413d00e5706d186c3b))
116-
11795
## [1.3.0](https://github.com/marcelblijleven/adventofcode/compare/v1.2.0...v1.3.0) (2021-11-30)
11896

11997

@@ -131,9 +109,6 @@ All notable changes to this project will be documented in this file. See [standa
131109

132110
* add more badges and examples ([1c5192b](https://github.com/marcelblijleven/adventofcode/commit/1c5192b46ee9c1414f4b10bb995d24564900f00b))
133111
* **README:** add script examples to README.md ([5c6febe](https://github.com/marcelblijleven/adventofcode/commit/5c6febe7a8673b2164f07ca716e3f3bf542eaa5e))
134-
* update README ([d7c127c](https://github.com/marcelblijleven/adventofcode/commit/d7c127cd3eab94661ec1b0bbe6c8b9e9146be38a))
135-
* update README ([64baa1e](https://github.com/marcelblijleven/adventofcode/commit/64baa1ec1d3bade42ad421f4055e21e871306344))
136-
* update README ([c52c5c5](https://github.com/marcelblijleven/adventofcode/commit/c52c5c586296627f93390eff72fbaa3f5f32b412))
137112

138113

139114
### ✨ Features
@@ -203,18 +178,6 @@ All notable changes to this project will be documented in this file. See [standa
203178
* strip _year suffix from day in clean_day ([e8925df](https://github.com/marcelblijleven/adventofcode/commit/e8925dfc3fc61e70f26708b52bdb9eadacc25211))
204179

205180

206-
### 📄 Documentation
207-
208-
* update README ([7a17ba7](https://github.com/marcelblijleven/adventofcode/commit/7a17ba7c1cd5ea5b3bc91cdee155b8cd8bfb3412))
209-
* update README ([fc47a76](https://github.com/marcelblijleven/adventofcode/commit/fc47a76c280ceaae60389075eb8ddff3bc27a8cd))
210-
* update README ([d3bf904](https://github.com/marcelblijleven/adventofcode/commit/d3bf904f5a7e3b4c053f85552d91b7739011c1d7))
211-
* update README ([63f28ee](https://github.com/marcelblijleven/adventofcode/commit/63f28ee51346179c7cac5d6ead2959fc0efc6ec5))
212-
* update README ([fdc1763](https://github.com/marcelblijleven/adventofcode/commit/fdc1763453be022353f0d75bda2af40a736df78b))
213-
* update README ([d5d1562](https://github.com/marcelblijleven/adventofcode/commit/d5d15622dca7c80c157bd0b8fb83e7b7a7e46dd4))
214-
* update README ([37d97f0](https://github.com/marcelblijleven/adventofcode/commit/37d97f09e6b37036bc5a083bf4a8f0c7f8f954b2))
215-
* update README ([f175dd3](https://github.com/marcelblijleven/adventofcode/commit/f175dd3a3ed4b5b9d1b64fd831e517540b0126d4))
216-
* update README ([2fed2ff](https://github.com/marcelblijleven/adventofcode/commit/2fed2ffaf2fac1b7268b95d19d6680b0ea91fbe3))
217-
218181
## [1.1.0](https://github.com/marcelblijleven/adventofcode/compare/v1.0.0...v1.1.0) (2021-11-19)
219182

220183

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
9976557856799875679875642456989998767978931098989876587878999876565667896543210123567899876794310234
2+
8765432145789983989864321345978999954569532987679965426567899865423457899654329439698987665679442545
3+
9898553234567899898765432499767899895689549876567894312458998543212679998785698998999996543458953456
4+
8987668765679998769986753987656798799899698765456789101345697654323567899896797987899989542557894597
5+
7698778978895129954397864797543445678978939988367895212467899875534568999999986576789877410136789989
6+
7539989989943239865298985698432134799654329876238954324588921976646899889998765435698765321245695678
7+
4321398991294345976129876986553346999743219765359995435789890989887898767899754324569876434557894567
8+
9932357890989496987235999898764457898752102976998789756899789999999976556689865546894987678967942456
9+
7893459939878989998499989789898768987643244599896578997947567898899875434599986657975998989878921347
10+
6899978919965578999987875678999978998754395699789468998933458987798654323678998768976899293989842568
11+
5767899998764455899976534779899989329895989987685357999212347976539875435678929899987920191099754989
12+
4356899987643234789987413566789998912989879987531238994301656987645989596789434921098939989198769899
13+
3245689998432124568998302345678987893979769898750126789212797899787898989899865699999998878999898789
14+
4346897998543345689863212558789796999868757789942334599433458998999987778999976987899987657899987645
15+
6567976697654576797654323567896545987654645679643545678945579987899896569998989876999874545678998434
16+
7988965498865687899875434578987856998763238998759856789757899876798765378987898765689963234567894323
17+
8999654319976798967989565689498967899542127789898769898968989965669876567896439876799854355989995434
18+
9498765423498899656798779894329878998743235678999889967899877654554987678989321997898769866798789645
19+
4349876434599999348939889986445989999987345789998994457898766542443498799678934598969899877895678956
20+
3256987595989888999423994399578997879996568998987653216789654321012349896579949789345999989924569969
21+
4345698989865676789212349298999875457899689767499864434578975993153569965456898993234998999212479898
22+
9559899876543134694325498987899764345698797654398765675678999789234698543234567894399877787993998787
23+
7998942965421012349434997876798621234899999865239977788789987698946987652126989975989566546889876546
24+
6897891977632163768949876565689540135679998752145698899898776587799998763234991099877452335679985434
25+
5956789876543245689769954434578932348799989543234999954987654465688999954756789198765321025899974323
26+
3347979997659456789898743125567896556999878956399876743498943334567899975678998989876432134679765434
27+
1234567998767768999987659012389987669898767898989954342349832123479999876989546976987563245678976755
28+
3569678969889879898998798923568998798789659999969895201298753334567891987895439765987675656789988767
29+
4678989657996998787899987894567999979678945899756789212459896567978953998998598654399899777893299878
30+
6989298743235987656799986789789398768599434698645698924599987798989769869897698765478967989965459989
31+
7892019651019876545899875678990239843489321986534567895989998939599898756789999896569546599996598796
32+
8989198772124985434599989889789349652578999898423498999878989012399999646796899997678933498989697654
33+
9678949989234997523678992997678998543456789789212349898956578993989898731234679998989321987679798793
34+
3568931098949886212789751034567987654567898698901298797543499989876789820124567899999910199568999989
35+
8689543987898775102457942123457998865689965457992999697621989875465698931435789967989891398459999876
36+
8797699876987654323568943234567989976799954354989876543210178954324987892387991349877689987378989765
37+
9898987654599875464899754345789876988898890123976998679633267893219876789998910598765578996569876543
38+
3979998943456987596789965956899965499997689359895679798545456789439765676789321679654356987679987654
39+
4568989894569998687892979877919894345986478998654567987656567996598754355698945998543245699789999765
40+
5699876795678969788921989989109789499894351989743456798767678987987643234567899876542123479899987976
41+
6989965689789459899542498999998678987643210578932345679878789898998792123676899965432014567929876987
42+
9976864578994344989656987999876534987654592469321236789989899789329989012345789987843123458912965698
43+
8985923467890123478968976899987621298766784578910123499993998543219879193456891298954434568929894569
44+
7654312356921354567899865678998542379879897699321234568932987654598768989569910129865677679998643459
45+
7842101239892465679999654567999653457989989789432545699653998767697657978978923457978788989998764578
46+
6543214356789568799998732356899764568997679896543756789979899879898744567899944767989899899899865789
47+
7654525487897689899876420124678975789996431997679898898998799989999932978967899988999987678789977897
48+
8775686598979799998765431285789996799987549989989989957899678994598763799545988999129876567698998956
49+
9989887679865988999896542376798987899999698777899976546789569965699854678934567898999865466567899349
50+
5698998989534567998987664567987699988931987656789988723499439876989965799123698987689654315456791298
51+
4567899998676979887699775679999532167899894345678999834568921989879876893244569754598765402367893987
52+
5989989769989897654545986799898954358998765456789321946789910198765987894997689643459897514589999996
53+
6795678999998796543235697998767895469999876567898943497899891987654598999889789652667959776689898987
54+
7894569878997689632123998989656976979981987698967964598998789999743459987679997543489542987896797699
55+
8932398767586579743434899978945897898870198799459895799878689998432369876568898764678931099945689431
56+
9543987656323489854575698656934789987653239912349789987964567896543498967456789898799992998756797210
57+
8665796546212349965689987545895678999795356799498678986543456989654987652345891949898789899898965423
58+
9976987632101467896798554436789789439896987898987567965432345678969887431337990134987678789969876675
59+
5698999543232345697987432124592995423997999967896459876521256899998776210126789999876598689756989776
60+
3569898674346556789996549036693987549979323456789345987432768999987654321234598789989434568934595987
61+
8698798765456687899989698945789999798765444578993234896545679988798765438756789578998623457899694598
62+
9987659878767798999878987957897889999879556989654346798959899976549887659867895489876534669998989999
63+
5699845989979899298767896898986578998989669998765457899767999895326998767998965345997645978987767899
64+
4987631296989932109656355789975467987898798889976769979978998789435679878999879469998756789896646789
65+
3986542345698654998743234678954389876569897679899878967989877698945797989999998998999867898765434890
66+
4987653457789799775810124589643298765456986565678989556299956567896896599878987887899998929854324691
67+
5698767878892987654321238899955129892349876464899995432198843477897999323459765676998799013992013989
68+
9979878989991098775543646789876399989498765343487896546297652346969788912399834345899695324989329978
69+
8767989796789989987655757899987988678997654212346797757986543457956567893987321256789589439878998967
70+
7656896545678976598866869998999876512987654301237898868997654579544456789875452387893478998767987656
71+
9738998437899865329877978956798765433496543212578999978998785989432345678986563598954567969659876544
72+
7629689545678974310989989432349986595987854323456893989129896792101567899997654569767679854546985433
73+
5434578959899765451398996545689597689898965454578912494298987893243459998999867689978898763434599212
74+
6545789767953986532567987856789498798769976579789894999987998954956598787895979799989987662125988301
75+
7856892979892397645698998969892359989656797679896799898976569879897987676796989999699876543019876312
76+
8769921989799498776789569878999459876545798789945698787895456999769876585689999998567987653236995423
77+
9878932998688999987893499989698998765434989890199987656965345987656987434567899876439798765345986564
78+
8989549876567896898992989796587899987325679931987654545893239876545987323489910987649649976456798775
79+
7497657988456954559789876572456799875456789899996543236789129766434596544595439998798432989987899889
80+
6569878999567893245699798341248678999578998658789654127679297654323987965689598999897521299999998996
81+
7698989998688932134987653210234569878989876545699943234568979865434899878799987899995439988913987895
82+
9987699889799541035699654321234698767999985435567899545678956976645789989899876789987598877894996654
83+
9876597679899432123498765452345987656899876423456998757789349798756892193998765679398697656999875443
84+
3987986546998543234679876743456797645799989910287899768996298659977891012989324589219987647899954321
85+
2199977634987657845789998754567988534678999891235989879765498843298932229876434695456898729999765210
86+
3398965420199789657893198766678976323459998789345678989879987654129646547986565789667999835798754321
87+
9987896554239898768999019897789875212345987698969799596997698865439897656798779899989989545679865432
88+
8766799669999929879198998998898984303459876567998999435989539976545998767899889999998978957999877545
89+
9954678998789012989297897549957895212569865456897678949878920987676999878942999987987569998910987696
90+
8765789654699123499986789321245987823498754349976577898769891398987898989656789876643468999699998989
91+
9986898943488939698765698932359876437987653298765456789655789459598976499867898765432127896587899878
92+
9998956732367898998983567893467987545698732129954398998744568969329995354978999865321056789456798769
93+
9899542101456997997542456789579998957789821019894289987623458978910989212989899976435145699212977556
94+
8789653212568976987631345997698999998997932198743168976545667899999878901296789997543234578909865445
95+
7698765333457895798545456789997899899876544987654347897996778921987767892345789898654357678998754323
96+
6549896544679934679656768999876585799987865699765756789889889899876645789556798798765468999698768210
97+
5431987758989124569867989799975464689999976899879867895678996799865434678967987679987689996569989432
98+
3210198767891012679878995689864343457998987987989879924899345679876656989979897565699998989432399553
99+
4523459898942123789989987897653212346897598995498989215679234578988767993298769434569876578941498764
100+
6735568999643445678990198987543203567965439875357894326789146678999879754579854325678998459653459895
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 2015 solutions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 2020 solutions
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from typing import List
2+
3+
from adventofcode.util.exceptions import SolutionNotFoundException
4+
from adventofcode.util.helpers import solution_timer
5+
from adventofcode.util.input_helpers import get_input_for_day
6+
7+
8+
def parse_input(input_data: List[str]) -> List[int]:
9+
return list(map(int, input_data[0].split(',')))
10+
11+
12+
def solve(input_data: List[int], rounds: int) -> int:
13+
seen = {value: index + 1 for index, value in enumerate(input_data[:-1])}
14+
number = input_data[-1]
15+
16+
for play_round in range(len(input_data), rounds):
17+
seen[number], number = play_round, 0 if number not in seen else play_round - seen[number]
18+
return number
19+
20+
21+
@solution_timer(2020, 15, 1)
22+
def part_one(input_data: List[str]):
23+
answer = solve(parse_input(input_data), 2020)
24+
25+
if not answer:
26+
raise SolutionNotFoundException(2020, 15, 1)
27+
28+
return answer
29+
30+
31+
@solution_timer(2020, 15, 2)
32+
def part_two(input_data: List[str]):
33+
answer = solve(parse_input(input_data), 30000000)
34+
35+
if not answer:
36+
raise SolutionNotFoundException(2020, 15, 2)
37+
38+
return answer
39+
40+
41+
if __name__ == '__main__':
42+
data = get_input_for_day(2020, 15)
43+
part_one(data)
44+
part_two(data)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 2021 solutions

0 commit comments

Comments
 (0)