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
use intcode::IntCode; | |
const INPUT: &str = include_str!("../input"); | |
fn parse(s: &str) -> Vec<i32> { | |
s.split(',').map(|x| x.parse().unwrap()).collect() | |
} | |
fn main() { | |
let input = parse(INPUT); |
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
use std::collections::HashMap; | |
use petgraph::{algo, Directed, Direction, Graph, Undirected}; | |
const INPUT: &str = include_str!("../input"); | |
type MyGraph = Graph<String, (), Directed>; | |
type MyUnGraph = Graph<String, (), Undirected>; | |
fn parse_directed(s: &str) -> MyGraph { |
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
#![feature(or_insert_with_key, option_unwrap_none)] | |
use std::collections::HashMap; | |
use petgraph::graph::{DiGraph, NodeIndex}; | |
use petgraph::visit::{self, IntoNeighborsDirected, IntoNodeIdentifiers}; | |
use petgraph::Direction; | |
use regex::Regex; | |
const INPUT: &str = include_str!("../input"); |
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
use std::collections::BTreeSet; | |
const INPUT: &str = include_str!("../input"); | |
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
enum Opcode { | |
Acc, | |
Jmp, | |
Nop, | |
} |
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
use std::cmp::Ordering; | |
const INPUT: &str = include_str!("../input"); | |
type Num = u64; | |
fn check_it(arr: &[Num], number: Num) -> bool { | |
arr.iter() | |
.enumerate() | |
.flat_map(|(i, a)| arr[i + 1..].iter().map(move |b| (a, b))) |
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
import React, { useMemo } from "react"; | |
import ReactDOM from "react-dom"; | |
import useLocalStorage from "@rehooks/local-storage"; | |
import { grams, kilograms } from "@buge/ts-units/mass"; | |
function App() { | |
const [value, setValue, deleteValue] = useLocalStorage("hello", kilograms(0)); | |
const [v1, v2] = useMemo( | |
() => [value.amount ?? "<null>", value.unit?.symbol ?? "<null>"], | |
[value] |
OlderNewer