Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/prettier-3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata authored Dec 21, 2023
2 parents 4488414 + bbc3f87 commit 64825b4
Show file tree
Hide file tree
Showing 37 changed files with 2,672 additions and 470 deletions.
2 changes: 1 addition & 1 deletion src/2023/day01.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day02.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day03.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day04.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day05.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day06.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day07.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day08.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day09.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day10.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day11.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day12.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day13.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day14.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day15.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day16.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day17.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
11 changes: 4 additions & 7 deletions src/2023/day17.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ function getNext(current, map, minSteps, maxSteps) {
export function part1(input, minSteps = 0, maxSteps = 3) {
const map = input.split('\n').map(line => line.split('').map(Number));
const key = ({ x, y, d, s }) => `${x},${y},${d},${s}`;
const initial = [
const compare = (a, b) => a.x + a.y - (b.x + b.y) || a.total - b.total;
const queue = new PriorityQueue(compare, [
{ x: 0, y: 0, total: 0, d: 'right', s: 0 },
{ x: 0, y: 0, total: 0, d: 'down', s: 0 },
];
const queue = new PriorityQueue(
(a, b) => a.x + a.y - (b.x + b.y) || a.total - b.total,
initial,
);
const visited = new Map(initial.map(n => [key(n), n]));
]);
const visited = new Map(queue.toArray().map(n => [key(n), n]));
let min = Infinity;
while (queue.size() > 0) {
const current = queue.dequeue();
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day18.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1 class="title-global"><a href="index.html">Advent of Code</a></h1>
</nav>
<div class="user">Shahar Talmi <a class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <a
href="https://www.wix.engineering/" target="_blank" class="sponsor-badge"
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">36*</span></div>
title="Member of sponsor: Wix Engineering">(Sponsor)</a> <span class="star-count">42*</span></div>
</div>
<div>
<h1 class="title-event">&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">$year=</span><a
Expand Down
Loading

0 comments on commit 64825b4

Please sign in to comment.