Skip to content

Commit

Permalink
Merge pull request #232 from romellem/2024/day-7
Browse files Browse the repository at this point in the history
2024 - Day 7
  • Loading branch information
romellem authored Dec 30, 2024
2 parents fd73ab9 + 06e175f commit f1de7f4
Show file tree
Hide file tree
Showing 9 changed files with 1,035 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 2024/7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Answers

| Part 1 | Part 2 |
| --------- | ---------- |
| ` ` | ` ` |
34 changes: 34 additions & 0 deletions 2024/7/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import path from 'path';
import fs from 'fs';

export const input: Array<{ result: number; numbers: number[] }> = fs
.readFileSync(path.join(import.meta.dirname, 'input.txt'), 'utf8')
.toString()
.trim()
.split('\n')
.map((line: string) => {
const [result, numbers] = line.split(':');
return {
result: parseInt(result, 10),
numbers: numbers
.trim()
.split(' ')
.map((v) => parseInt(v, 10)),
};
});

export const sampleInput: Array<{ result: number; numbers: number[] }> = fs
.readFileSync(path.join(import.meta.dirname, 'sample-input.txt'), 'utf8')
.toString()
.trim()
.split('\n')
.map((line: string) => {
const [result, numbers] = line.split(':');
return {
result: parseInt(result, 10),
numbers: numbers
.trim()
.split(' ')
.map((v) => parseInt(v, 10)),
};
});
Loading

0 comments on commit f1de7f4

Please sign in to comment.