View walk-dir-zod-rust-script.rs
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
// youtube: https://youtu.be/dbEY6j98llw | |
// twitter: https://twitter.com/robertkingNZ | |
use std::collections::HashMap; | |
use std::fs; | |
fn main() { | |
let mut map = HashMap::new(); | |
let zod_location = "/Users/rk/WebstormProjects/thred-cloud/tauri/node_modules/zod"; |
View advent_of_code_2022_day_16.rs
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
// live coding: https://youtu.be/IlZFxkTrlW0 | |
// twitter: https://twitter.com/robertkingNZ | |
// problem: https://adventofcode.com/2022/day/16 | |
use std::collections::{HashSet, HashMap}; | |
use regex::Regex; | |
const _EX: &str = "Valve RU has flow rate=0; tunnels lead to valves YH, ID | |
Valve QK has flow rate=24; tunnels lead to valves PQ, PP | |
Valve RP has flow rate=11; tunnels lead to valves RM, BA, RI, EM |
View advent_of_code_2022_day_15.rs
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
// https://adventofcode.com/2022/day/15 | |
// https://www.youtube.com/@robertking | |
use std::collections::{BTreeMap, HashSet}; | |
use regex::Regex; | |
const INPUT: &str = "Sensor at x=3391837, y=2528277: closest beacon is at x=3448416, y=2478759 | |
Sensor at x=399473, y=1167503: closest beacon is at x=1188862, y=2000000 | |
Sensor at x=3769110, y=2896086: closest beacon is at x=4076658, y=2478123 | |
Sensor at x=900438, y=3835648: closest beacon is at x=-435606, y=3506717 |
View meta_hackercup_a2_perfectly_balanced.rs
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
/* | |
https://www.facebook.com/codingcompetitions/hacker-cup/2022/round-2/problems/A2 | |
https://youtu.be/CsSGu51V7YQ | |
*/ | |
use std::collections::HashSet; | |
use rand::{thread_rng, Rng}; | |
use std::io; | |
use std::io::Read; | |
use crate::fenwick_tree::FenwickTree; |
View New Zealand Programming Contest 2022 - Max Empty.py
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
# https://youtu.be/zo_UHPI78H8 | |
# @robertkingNZ | |
# thred.co.nz | |
""" | |
There's a clone of the contest on our prog4fun server: https://prog4fun.csse.canterbury.ac.nz. | |
This is a public server that anyone can register on with any credentials. | |
Once registered they should enrol themselves in the "course" Programming Contest Problem Archive and they'll then be able to access the clone of NZPC-2022 here: | |
https://prog4fun.csse.canterbury.ac.nz/mod/quiz/view.php?id=2796 | |
""" |
View lemonade_life.rs
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
// https://www.facebook.com/codingcompetitions/hacker-cup/2022/round-1/problems/C | |
fn bad(i: usize, j: usize, k: usize, t: &Vec<Vec<i64>>) -> bool { | |
let rise1 = t[j][1] - t[i][1]; | |
let rise2 = t[k][1] - t[i][1]; | |
let run1 = t[j][0] - t[i][0]; | |
let run2 = t[k][0] - t[i][0]; | |
if run1 == 0 { | |
return false; | |
} |
View second-flight.rs
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
// @robertkingnz | |
// https://www.youtube.com/c/RobertKing/videos | |
// https://www.facebook.com/codingcompetitions/hacker-cup/2022/qualification-round/problems/D | |
use std::collections::{HashMap}; | |
use std::mem; | |
fn main() { | |
let (r, w) = (std::io::stdin(), std::io::stdout()); | |
let mut sc = IO::new(r.lock(), w.lock()); |
View pizza_delivery.rs
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
/* | |
@robertkingnz | |
https://www.youtube.com/c/RobertKing/videos -> https://youtu.be/Z5WzJ9jbnKg | |
https://codingcompetitions.withgoogle.com/kickstart/round/00000000008cb0f5/0000000000ba86e6 | |
*/ | |
extern crate core; | |
fn calc_toll(c: i64, toll: &(char, i64)) -> i64 { | |
let ans = match toll.0 { |
View winetasting.rs
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
/* | |
https://www.youtube.com/c/RobertKing/videos | |
@robertkingnz | |
problem: https://www.facebook.com/codingcompetitions/hacker-cup/2011/round-1a/problems/C | |
video: | |
*/ | |
use std::collections::HashMap; | |
pub struct Combination { |
View google_kickstart_parcels.rs
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
/* | |
problem: https://codingcompetitions.withgoogle.com/kickstart/round/00000000008f4a94/0000000000b55465 | |
youtube: https://youtu.be/Yvj18KBThsE (subscribe) | |
twitter: https://twitter.com/robertkingNZ (follow) | |
*/ | |
use std::collections::VecDeque; | |
use std::usize; |
NewerOlder