Our great sponsors
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- Onboard AI - Learn any GitHub repo in 59 seconds
- SaaSHub - Software Alternatives and Reviews
-
I use itertools::Itertools which have a nice all_unique (internally, it creates a hashset and insert elements one by one unless it already contains it) but if I really wanted efficiency, I would manage my own hashset because this method is called for each character.
-
for my solution, I used a bitset as an auxillary data structure. The trick is that since chracters are all lower case there's only 26 of them. This means if you use a u32 where each bit is a chracter, you can just OR the slice together and count the number of bits after ORing. https://github.com/Isawan/advent-of-code/blob/master/2022/src/bin/day6-fast.rs
-
InfluxDB
Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.