Skip to content

Commit 156ca8e

Browse files
fix(2021-day-08): descrambled display codes weren't properly alphabatized
1 parent 5ad7952 commit 156ca8e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

2021/day-08/display.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// })
2929
// }
3030

31-
const alphabetical = (a, b) => a - b
3231

3332
/**
3433
* Takes a string of scrambled codes and deduces which codes correspond
@@ -41,7 +40,7 @@ const descrambleSignal = (data) => {
4140
console.debug('2021-day-08 descrambleSignal()')
4241

4342
const scrambledCodes = data.split(' ')
44-
.map((code) => code.split('').sort(alphabetical)) // Convert each code to alphabetized arrays
43+
.map((code) => code.split('').sort()) // Convert each code to alphabetized arrays
4544
const segmentCodes = Array(7) // For caching the identified segment codes as we find them
4645
const sortedCodes = Array(10) // For caching the identified number codes as we find them
4746

0 commit comments

Comments
 (0)