advent-of-code-2022

By foresterre

Advent-of-code-2022 Alternatives

Similar projects and alternatives to advent-of-code-2022

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better advent-of-code-2022 alternative or higher similarity.

advent-of-code-2022 reviews and mentions

Posts with mentions or reviews of advent-of-code-2022. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-12-02.
  • -🎄- 2022 Day 3 Solutions -🎄-
    250 projects | /r/adventofcode | 2 Dec 2022
    Rust 3a: use day_03::{intersect, priority}; fn main() { let input = include_bytes!("../../../input/day_03.txt"); let sum_of_priorities = input .split(|&byte| byte == b'\n') .map(|line| line.split_at(line.len() / 2)) // split into equally sized compartments .map(|(l, r)| intersect([l.iter().copied(), r.iter().copied()])) // find the intersection of the compartments .map(priority) // map to priorities .sum::(); println!("{}", sum_of_priorities); } 3b: use day_03::{intersect, priority}; fn main() { let input = include_bytes!("../../../input/day_03.txt"); let lines = input.split(|&byte| byte == b'\n').collect::>(); let sum_of_priorities = lines .chunks(3) .map(|chunks| intersect(chunks.iter().map(|chunk| chunk.iter().copied()))) .map(priority) // map to priorities .sum::(); println!("{}", sum_of_priorities); } shared code (module: `day_03`): use std::collections::HashSet; pub fn intersect(sets: I) -> u8 where I: IntoIterator, Set: IntoIterator, { let common = sets .into_iter() .map(|set| { let set: HashSet = HashSet::from_iter(set); set }) .reduce(|l, r| &l & &r); *common.unwrap().iter().next().unwrap() } pub fn priority(item: u8) -> u32 { (if item >= b'a' { item + 1 - b'a' } else { item + 27 - b'A' }) as u32 } repo: https://github.com/foresterre/advent-of-code-2022

Stats

Basic advent-of-code-2022 repo stats
1
0
10.0
over 1 year ago

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com