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
#include <errno.h> | |
#include <regex.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* | |
* Advent of Code 2024 Day 3 Part 1 | |
*/ |
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 itertools::Itertools; | |
use std::io; | |
fn main() { | |
// command must be in format of "add <name> to <department>" or "get <department>". Command | |
// must start with add or get. For the "get" command, "get all" will get all employees from | |
// each department sorted in alphabetical order by department. | |
let mut employee_data = HashMap::new(); |
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
fn main() { | |
let normal_str = String::from("first apple"); | |
let pig_latin = convert_to_pig_latin(&normal_str); | |
println!("Input: {}\nOutput: {}", normal_str, pig_latin); | |
} | |
fn convert_to_pig_latin(input_str: &String) -> String { | |
let mut str_array = vec![]; |
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; | |
fn main() { | |
let mut x: Vec<i32> = vec![6,3,2,2,5,7,9,9,8,6,4,10,11,11,11,11,12,13,14]; | |
println!("Inputted vector: {:?}", x); | |
println!("Mean: {}", mean(&x)); | |
println!("Median: {}", median(&mut x)); | |
let y = mode(&x); | |
println!("Mode: value {} occurs {} times", y.0, y.1); | |
} |