aoc/2019/04/part1.js

18 lines
366 B
JavaScript
Raw Permalink Normal View History

2019-12-05 17:08:18 +00:00
// puzzle input
const inputMin = 172930;
const inputMax = 683082;
amt = 0;
for (let i = inputMin; i < inputMax; i++) {
adjChars = false;
increasing = false;
let prev;
for (char of String(i)) {
if (char == prev) {adjChars = true}
if (char < prev) {increasing = true}
prev = char;
}
if (adjChars && !increasing) {amt++;console.log(i)}
}
console.log(amt);