Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata committed Dec 16, 2023
1 parent 044050d commit c48e43a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/2023/day15.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export function part1(input) {
export function part2(input) {
const operations = input.split(',').map(x => {
const [label, focal] = x.split(/[-=]/);
return focal === ''
? { op: '-', label }
: { op: '=', label, focal: +focal };
return focal ? { op: '=', label, focal: +focal } : { op: '-', label };
});
const hashmap = new Array(256).fill().map(() => []);
for (const operation of operations) {
Expand Down

0 comments on commit c48e43a

Please sign in to comment.