I'm keen to get feedback at this stage so please head on over to Github and leave a comment if you so choose...
github.com/tcbrindle/fl...
I'm keen to get feedback at this stage so please head on over to Github and leave a comment if you so choose...
github.com/tcbrindle/fl...
At least part 1 was easy.
At least part 1 was easy.
github.com/tcbrindle/ad...
github.com/tcbrindle/ad...
A simple vector was good enough for part 1, but more iterations in part 2 required a different approach. I went for storing the data in a (value, count) hash map, which worked very well. A nice puzzle!
github.com/tcbrindle/ad...
A simple vector was good enough for part 1, but more iterations in part 2 required a different approach. I went for storing the data in a (value, count) hash map, which worked very well. A nice puzzle!
github.com/tcbrindle/ad...
Github: github.com/tcbrindle/ad...
Github: github.com/tcbrindle/ad...
github.com/tcbrindle/ad...
github.com/tcbrindle/ad...
Using a hash set gives about a 10x speedup versus a sorted vector + binary search, but the latter is plenty fast enough for the problem size
Using a hash set gives about a 10x speedup versus a sorted vector + binary search, but the latter is plenty fast enough for the problem size
Part 1 had me scratching my head for a little while, because I didn't account for the fact that an 'X' can be the root of more than one 'XMAS'. Fortunately part 2 was less tricky.
Code: github.com/tcbrindle/ad...
Part 1 had me scratching my head for a little while, because I didn't account for the fact that an 'X' can be the root of more than one 'XMAS'. Fortunately part 2 was less tricky.
Code: github.com/tcbrindle/ad...
Practical Tips for Safer C++ - Tristan Brindle - C++ on Sea 2024
#coding #cplusplus #cpp #programming #safety
Practical Tips for Safer C++ - Tristan Brindle - C++ on Sea 2024
#coding #cplusplus #cpp #programming #safety