2015 day5 p1 & p2

This commit is contained in:
Tristan 2018-12-09 17:40:24 +00:00
parent 91610024c9
commit aa1540e34d
5 changed files with 1026 additions and 4 deletions

1000
2015/5/input.txt Normal file

File diff suppressed because it is too large Load diff

11
2015/5/part1.js Normal file
View file

@ -0,0 +1,11 @@
const fs = require('fs');
const input = fs.readFileSync('input.txt', 'utf-8').split('\n');
let counter = 0;
for (let str of input) {
if ((str.match(/(a|e|i|o|u)/g) || []).length >= 3 &&
str.match(/(\w)\1/g) &&
!str.match(/(ab|cd|pq|xy)/))
counter++;
}
console.log(counter)

9
2015/5/part2.js Normal file
View file

@ -0,0 +1,9 @@
const fs = require('fs');
const input = fs.readFileSync('input.txt', 'utf-8').split('\n');
let counter = 0;
for (let str of input) {
if (str.match(/(\w{2}).*\1/g) && str.match(/(\w)\w\1/g))
counter++;
}
console.log(counter)

View file

@ -2,8 +2,8 @@
1. [py :star: :star:](https://adventofcode.com/2015/day/1 "see puzzle")
1. [js :star: :star:](https://adventofcode.com/2015/day/2 "see puzzle")
1. [py :star: :star:](https://adventofcode.com/2015/day/3 "see puzzle")
1. [py :star: :star:](https://adventofcode.com/2015/day/5 "see puzzle")
1. ...
1. [py :star: :star:](https://adventofcode.com/2015/day/4 "see puzzle")
1. [js :star: :star:](https://adventofcode.com/2015/day/5 "see puzzle")
# Languages Used
### Python
@ -16,3 +16,5 @@
1. [-](https://adventofcode.com/2015/day/1 "see puzzle")
1. [:star: :star:](https://adventofcode.com/2015/day/2 "see puzzle")
1. [-](https://adventofcode.com/2015/day/3 "see puzzle")
1. [-](https://adventofcode.com/2015/day/3 "see puzzle")
1. [:star: :star:](https://adventofcode.com/2015/day/3 "see puzzle")

View file

@ -13,8 +13,8 @@ if (advent) {
1. [py :star: :star:](https://adventofcode.com/2015/day/1 "see puzzle")
1. [js :star: :star:](https://adventofcode.com/2015/day/2 "see puzzle")
1. [py :star: :star:](https://adventofcode.com/2015/day/3 "see puzzle")
1. [py :star: :star:](https://adventofcode.com/2015/day/5 "see puzzle")
1. [-](https://adventofcode.com/2015/day/6 "see puzzle")
1. [py :star: :star:](https://adventofcode.com/2015/day/4 "see puzzle")
1. [js :star: :star:](https://adventofcode.com/2015/day/5 "see puzzle")
#### [2018](https://adventofcode.com/2018 "2018 puzzle calendar")
1. [js :star: :star:](https://adventofcode.com/2015/day/1 "see puzzle")