Created
December 3, 2020 07:40
-
-
Save felix-larsen/2f2db141e4c7d3100be40f1774cad4ba to your computer and use it in GitHub Desktop.
3rd December solution - Advent of Code 2020 - swift
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
let treeCount = countTrees(in: lines, dX: 3, dY: 1) | |
print(treeCount) |
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
var treeCounts = [Int]() | |
treeCounts.append(countTrees(in: lines, dX: 1, dY: 1)) | |
treeCounts.append(countTrees(in: lines, dX: 3, dY: 1)) | |
treeCounts.append(countTrees(in: lines, dX: 5, dY: 1)) | |
treeCounts.append(countTrees(in: lines, dX: 7, dY: 1)) | |
treeCounts.append(countTrees(in: lines, dX: 1, dY: 2)) | |
print(treeCounts.reduce(1, *)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment