This file contains hidden or 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
| uint64_t top_three(const std::vector<std::string>& data) { | |
| auto by_elf = data | | |
| // group by elf: range{range{string}} | |
| std::views::lazy_split(std::string{}) | | |
| // sum up the calories for each elf: range{uint64_t} | |
| std::views::transform([](const auto& elf) -> uint64_t { | |
| // std::string -> uint64_t | |
| auto to_unsigned = | |
| [](const auto& in) { return std::stoull(in); }; | |
| // make a view of uint64_t: range{string} -> range{uint64_t} |
OlderNewer