This file contains 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
const INPUT: &str = "..snip.."; | |
fn main() { | |
let sum: i64 = INPUT.lines() | |
.map(extract_digits) | |
.map(|d| extrapolate_next(&d)) | |
.sum(); | |
println!("part1: {}", sum); | |
let sum: i64 = INPUT.lines() |
This file contains 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
use std::collections::HashMap; | |
use lazy_static::lazy_static; | |
use regex::Regex; | |
const INPUT: &str = "..snip.."; | |
fn main() { | |
let mut iter = INPUT.lines(); |
This file contains 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
use std::{collections::{HashMap, BinaryHeap}, cmp::Reverse}; | |
const INPUT: &str = "..snip.."; | |
fn main() { | |
let mut heap: BinaryHeap<Reverse<Cards>> = INPUT.lines() | |
.map(parse) | |
.fold(BinaryHeap::new(), |mut acc, cards| { | |
acc.push(Reverse(cards)); | |
acc |
This file contains 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
use lazy_static::lazy_static; | |
use regex::Regex; | |
const INPUT: &str = "..snip.."; | |
fn main() { | |
let races = parse_input(INPUT); | |
let mut res: usize = 0; | |
for race in races.iter() { | |
let count = |
This file contains 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
use lazy_static::lazy_static; | |
use regex::Regex; | |
const INPUT: &str = "..snip.."; | |
lazy_static! { | |
static ref RE_NUM: Regex = Regex::new(r"(\d+)").unwrap(); | |
} | |
#[derive(Debug)] |
This file contains 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
use std::collections::HashMap; | |
use lazy_static::lazy_static; | |
use regex::Regex; | |
const INPUT: &str = "..snip.."; | |
fn main() { | |
let sum: u32 = INPUT.lines() | |
.map(parse_game) |
This file contains 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
use std::collections::HashMap; | |
const INPUT: &str = "..snip.."; | |
#[derive(Debug)] | |
struct Info { | |
symbol_map: Vec<Vec<bool>>, | |
numbers: Vec<Number>, | |
} |
This file contains 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
use lazy_static::lazy_static; | |
use regex::Regex; | |
const INPUT: &str = "..snip.."; | |
fn main() { | |
let sum: u32 = INPUT.lines() | |
.map(parse_game_info) | |
.filter(check_cube_count) | |
.map(|game| game.id) |
This file contains 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
const INPUT: &str = "...snip..."; | |
fn main() { | |
// part1 | |
let sum: u32 = INPUT.lines() | |
.map(extract_digit) | |
.sum(); | |
println!("part1 sum: {}", sum); | |
// part2 |
This file contains 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
#!/bin/sh | |
set -e | |
# reset | |
pkill xcape | echo -n | |
setxkbmap -layout us | |
# SandS | |
xmodmap -e 'keycode 255=space' |
NewerOlder