-
-
Save laacz/e8096d890b9107a76a9e1ab88083ad51 to your computer and use it in GitHub Desktop.
AoC, task 1, part 2. Swift version. Slow as fuck.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let path = Bundle.main.path(forResource: "01.txt", ofType: nil)! | |
let str = try String(contentsOfFile: path, encoding: String.Encoding.utf8) | |
let lines = str.split(whereSeparator: \.isNewline).map({Int($0)}) | |
for a in lines { | |
for b in lines { | |
for c in lines { | |
if (a! + b! + c! == 2020) { | |
print(a! * b! * c!) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment