filmov
tv
Advent of Code 2020 - Day 3
Показать описание
42nd on part 1; 15th on part 2. About 40 seconds behind this time.
This is a basic grid problem. I have a set of conventions I always use for grid problems; the dimensions are "rows" and "columns", indexed by variables named "r" and "c". The upper-left corner is (0,0). Rows increase down and columns increase to the right. Rows are always the first index. i.e. always G[r][c] never G[c][r].
I think it's helpful to have something like this in mind. It doesn't have to be the same as mine; another common choice is x and y with y increasing up. Otherwise you have to think through all these decisions, which costs time and increases the chance of mistakes. I was lucky in this case that my conventions lined up with the problem statement.
This is a basic grid problem. I have a set of conventions I always use for grid problems; the dimensions are "rows" and "columns", indexed by variables named "r" and "c". The upper-left corner is (0,0). Rows increase down and columns increase to the right. Rows are always the first index. i.e. always G[r][c] never G[c][r].
I think it's helpful to have something like this in mind. It doesn't have to be the same as mine; another common choice is x and y with y increasing up. Otherwise you have to think through all these decisions, which costs time and increases the chance of mistakes. I was lucky in this case that my conventions lined up with the problem statement.
Learn Kotlin With the Kotlin Team: Advent of Code 2020 #1
Advent of Code 2020 in APL!
twoSum | Advent of Code 2020 Day 1
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #8
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #6
2020 advent of code solutions - day 19
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #3
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #9
Learn Kotlin with The Kotlin Team: Advent of Code 2020 #2
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #4
Advent of Code 2020 - Day 1
Learn Kotlin with the Kotlin Team: Advent of Code 2020 #5
Advent of Code 2020, Day 5: Boarding the Plane
Day 7/25: Advent of Code 2020
I Did Competitive Coding: Advent of Code 2020
Hardest Advent of Code 2020 Problem (day 20 Jigsaw, backtracking)
Advent of Code 2020 - Day 1
Advent of Code 2020 - Day 3
Advent of Code 2020 / 20 - visualization
Advent of Code 2020 - Day 7
Learn Kotlin with the Kotlin Team: Advent of Code #7
Advent of Code 2020 - Day 20
Advent of Code 2020 Day 1 - using Python
Day 4/25: Advent of Code 2020
Комментарии