├── .gitignore ├── src ├── rust_basics │ ├── strings.rs │ ├── shadowing.rs │ ├── mod.rs │ ├── data_types.rs │ ├── loops.rs │ ├── functions.rs │ ├── slices.rs │ ├── structs.rs │ ├── example_guess_game.rs │ ├── vectors.rs │ ├── example_rectangle_area.rs │ ├── references.rs │ ├── enums.rs │ └── ownership.rs ├── challenges │ ├── mod.rs │ ├── algorithms │ │ ├── mod.rs │ │ ├── simple_array_sum.rs │ │ └── solve_me_first.rs │ └── thirty_days_of_code │ │ ├── day_00.rs │ │ ├── day_05.rs │ │ ├── day_09.rs │ │ ├── day_07.rs │ │ ├── day_16.rs │ │ ├── day_02.rs │ │ ├── mod.rs │ │ ├── day_10.rs │ │ ├── day_01.rs │ │ ├── day_06.rs │ │ ├── day_03.rs │ │ ├── day_20.rs │ │ ├── day_29.rs │ │ ├── day_17.rs │ │ ├── day_14.rs │ │ ├── day_04.rs │ │ ├── day_28.rs │ │ ├── day_08.rs │ │ ├── day_25.rs │ │ ├── day_11.rs │ │ └── day_26.rs ├── main.rs └── functions.rs ├── Cargo.toml ├── README.md └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /src/rust_basics/strings.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn main() { 3 | 4 | } -------------------------------------------------------------------------------- /src/challenges/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod thirty_days_of_code; 2 | pub mod algorithms; -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod challenges; 2 | mod functions; 3 | mod rust_basics; 4 | 5 | fn main() { 6 | challenges::thirty_days_of_code::day_17::main(); 7 | } 8 | -------------------------------------------------------------------------------- /src/challenges/algorithms/mod.rs: -------------------------------------------------------------------------------- 1 | // See all the challenges at: 2 | // https://www.hackerrank.com/challenges 3 | 4 | #![allow(dead_code)] 5 | 6 | pub mod solve_me_first; 7 | pub mod simple_array_sum; 8 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_00.rs: -------------------------------------------------------------------------------- 1 | // 0. Hello, World 2 | // https://www.hackerrank.com/challenges/30-hello-world 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let input = functions::read_line(); 8 | println!("Hello, World.\n{}", input); 9 | } 10 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hackerrank-challenges-rust" 3 | version = "0.1.0" 4 | authors = ["Santiago Degetau"] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | rand = "0.3.14" -------------------------------------------------------------------------------- /src/functions.rs: -------------------------------------------------------------------------------- 1 | // functions.rs 2 | // Generic functions to avoid writing them over and over again. 3 | 4 | pub fn read_line() -> String { 5 | let mut input = String::new(); 6 | std::io::stdin() 7 | .read_line(&mut input) 8 | .expect("Could not read stdin!"); 9 | return input; 10 | } 11 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_05.rs: -------------------------------------------------------------------------------- 1 | // 5. Loops 2 | // https://www.hackerrank.com/challenges/30-loops 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let num: i32 = functions::read_line().trim().parse().unwrap(); 8 | for i in 1..11 { 9 | println!("{} x {} = {}", num, i, num * i); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/rust_basics/shadowing.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | let x = 2; // x = 2 3 | let x = x + 1; // x = 3 4 | let x = x * 2; // x = 6 5 | println!("x = {}", x); // x = 6 6 | 7 | let spaces = " "; 8 | let spaces = spaces.len(); 9 | println!("spaces.len() = {}", spaces); 10 | 11 | // Not Allowed: 12 | // let mut spaces = ""; 13 | // spaces = spaces.len(); 14 | } 15 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_09.rs: -------------------------------------------------------------------------------- 1 | // 9. Recursion 2 | // https://www.hackerrank.com/challenges/30-recursion 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let t: i32 = functions::read_line().trim().parse().unwrap(); 8 | println!("{}", factorial(t)); 9 | } 10 | 11 | pub fn factorial(n: i32) -> i32 { 12 | if n <= 1 { 13 | return 1; 14 | } 15 | return n * factorial(n - 1); 16 | } 17 | -------------------------------------------------------------------------------- /src/rust_basics/mod.rs: -------------------------------------------------------------------------------- 1 | // Examples taken from The Rust Programming Language book 2 | // https://doc.rust-lang.org/stable/book/ 3 | 4 | #![allow(dead_code)] 5 | 6 | pub mod data_types; 7 | pub mod enums; 8 | pub mod example_guess_game; 9 | pub mod example_rectangle_area; 10 | pub mod functions; 11 | pub mod loops; 12 | pub mod ownership; 13 | pub mod references; 14 | pub mod shadowing; 15 | pub mod slices; 16 | pub mod strings; 17 | pub mod structs; 18 | pub mod vectors; 19 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_07.rs: -------------------------------------------------------------------------------- 1 | // 7. Arrays 2 | // https://www.hackerrank.com/challenges/30-arrays/problem 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let _: String = functions::read_line(); // first line not needed (size of array) 8 | let str_numbers: String = String::from(functions::read_line().trim()); 9 | 10 | let mut numbers = str_numbers.split(" ").collect::>(); 11 | numbers.reverse(); 12 | 13 | println!("{}", numbers.join(" ")); 14 | } 15 | -------------------------------------------------------------------------------- /src/rust_basics/data_types.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | pub fn main() { 4 | let x: u32 = "42".parse().expect("Not a number!"); 5 | println!("x = {}", x); 6 | 7 | // Integer Literals 8 | let decimal: i32 = 100_000; 9 | let hex: i32 = 0xff; 10 | let octal: i32 = 0o77; 11 | let binary: i32 = 0b1111_0000; 12 | println!("{}, {}, {}, {}", decimal, hex, octal, binary); 13 | 14 | // Arrays 15 | let a: [i32; 5] = [1, 2, 3, 4, 5]; 16 | let a = [1i32; 5]; 17 | } 18 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_16.rs: -------------------------------------------------------------------------------- 1 | // 16. Exceptions - String to Integer 2 | // https://www.hackerrank.com/challenges/30-exceptions-string-to-integer 3 | // NOTE: When I "solved" this challenge it wasn't available for Rust on Hackerrank. 4 | 5 | use crate::functions; 6 | 7 | pub fn main() { 8 | match functions::read_line().trim().parse::() { 9 | Ok(n) => { 10 | println!("{}", n); 11 | } 12 | Err(_) => { 13 | println!("Bad String"); 14 | } 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_02.rs: -------------------------------------------------------------------------------- 1 | // 2. Operators 2 | // https://www.hackerrank.com/challenges/30-operators 3 | // NOTE: When I "solved" this challenge it wasn't available for Rust on Hackerrank. 4 | 5 | use crate::functions; 6 | 7 | pub fn main() { 8 | let meal_cost: f32 = functions::read_line().trim().parse().unwrap(); 9 | let tip_percent: f32 = functions::read_line().trim().parse().unwrap(); 10 | let tax_percent: f32 = functions::read_line().trim().parse().unwrap(); 11 | 12 | let total_cost: f32 = 13 | meal_cost + (meal_cost * (tip_percent / 100.0)) + (meal_cost * (tax_percent / 100.0)); 14 | println!("{}", total_cost.round()); 15 | } 16 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/mod.rs: -------------------------------------------------------------------------------- 1 | // See all the challenges at: 2 | // https://www.hackerrank.com/challenges 3 | 4 | #![allow(dead_code)] 5 | 6 | pub mod day_00; 7 | pub mod day_01; 8 | pub mod day_02; 9 | pub mod day_03; 10 | pub mod day_04; 11 | pub mod day_05; 12 | pub mod day_06; 13 | pub mod day_07; 14 | pub mod day_08; 15 | pub mod day_09; 16 | pub mod day_10; 17 | pub mod day_11; 18 | // pub mod day_12; 19 | // pub mod day_13; 20 | pub mod day_14; 21 | // pub mod day_15; 22 | pub mod day_16; 23 | pub mod day_17; 24 | // pub mod day_18; 25 | // pub mod day_19; 26 | pub mod day_20; 27 | pub mod day_25; 28 | pub mod day_26; 29 | pub mod day_28; 30 | pub mod day_29; 31 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_10.rs: -------------------------------------------------------------------------------- 1 | // 10. Binary Numbers 2 | // https://www.hackerrank.com/challenges/30-binary-numbers 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let input: i32 = functions::read_line().trim().parse().unwrap(); 8 | let binary: String = format!("{:b}", input); 9 | 10 | let mut curr_seq = 0; 11 | let mut max_seq = 0; 12 | 13 | for c in binary.chars() { 14 | if c == '1' { 15 | curr_seq += 1; 16 | } else { 17 | curr_seq = 0; 18 | } 19 | 20 | if max_seq < curr_seq { 21 | max_seq = curr_seq; 22 | } 23 | } 24 | println!("{}", max_seq); 25 | } 26 | -------------------------------------------------------------------------------- /src/challenges/algorithms/simple_array_sum.rs: -------------------------------------------------------------------------------- 1 | // Simple Array Sum 2 | // https://www.hackerrank.com/challenges/simple-array-sum 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let _ = functions::read_line(); // no need to use this value. 8 | let str_arrays_elements: String = String::from(functions::read_line().trim()); 9 | let elements: Vec = str_arrays_elements 10 | .split(' ') 11 | .into_iter() 12 | .map(|s| s.parse::()) 13 | .collect::, std::num::ParseIntError>>() 14 | .unwrap(); 15 | let mut sum = 0; 16 | for value in elements { 17 | sum += value; 18 | } 19 | println!("{}", sum); 20 | } 21 | -------------------------------------------------------------------------------- /src/rust_basics/loops.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | a_loop(); 3 | for_loop(); 4 | } 5 | 6 | fn a_loop() { 7 | let mut counter = 0; 8 | let result = loop { 9 | counter += 1; 10 | if counter == 10 { 11 | break counter * 2; 12 | } 13 | }; 14 | println!("Loop that returns a value: {}", result); 15 | } 16 | 17 | fn for_loop() { 18 | let a = [10, 20, 30, 40, 50]; 19 | 20 | // Forward Iterate 21 | for element in a.iter() { 22 | println!("For loop value: {}", element); 23 | } 24 | 25 | // Reverse Iterate 26 | for element in a.iter().rev() { 27 | println!("[Reversed] For loop value: {}", element); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/rust_basics/functions.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | let x = 5; 3 | 4 | // Parameters 5 | print_number(x); // = 5 6 | 7 | let y = { 8 | let x = 3; 9 | x + 1 // no semicolon (to return the value) 10 | }; 11 | 12 | print_number(y); // = 4 13 | 14 | print_number(five()); // = 5 15 | 16 | let z = plus_one(5); 17 | print_number(z); // = 6 18 | print_number(plus_one(5)); // = 6 19 | } 20 | 21 | fn print_number(x: i32) { 22 | println!("The value passed is: {}", x); 23 | } 24 | 25 | // Function with return type 26 | fn five() -> i32 { 27 | 5 28 | } 29 | 30 | // Function with parameter and return 31 | fn plus_one(x: i32) -> i32 { 32 | x + 1 33 | } 34 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_01.rs: -------------------------------------------------------------------------------- 1 | // 1. Data Types 2 | // https://www.hackerrank.com/challenges/30-data-types 3 | // NOTE: When I "solved" this challenge it wasn't available for Rust on Hackerrank. 4 | 5 | use crate::functions; 6 | 7 | pub fn main() { 8 | let i: i32 = 4; 9 | let d: f32 = 4.0; 10 | let mut s: String = String::from("HackerRank "); 11 | 12 | let int_input: i32 = functions::read_line().trim().parse().unwrap(); 13 | let double_input: f32 = functions::read_line().trim().parse().unwrap(); 14 | let string_input: String = String::from(functions::read_line()); 15 | 16 | s.push_str(&string_input); 17 | 18 | println!("{}\n{}\n{}", i + int_input, d + double_input, s); 19 | } 20 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_06.rs: -------------------------------------------------------------------------------- 1 | // 6. Let's Review 2 | // https://www.hackerrank.com/challenges/30-review-loop 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let t: i32 = functions::read_line().trim().parse().unwrap(); 8 | for _ in 0..t { 9 | let word = String::from(functions::read_line().trim()); 10 | let mut evens = String::new(); 11 | let mut odds = String::new(); 12 | 13 | for (index, character) in word.chars().enumerate() { 14 | if index % 2 == 0 { 15 | evens.push_str(&character.to_string()); 16 | } else { 17 | odds.push_str(&character.to_string()); 18 | } 19 | } 20 | 21 | println!("{} {}", evens, odds); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/rust_basics/slices.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | pub fn main() { 4 | let mut s = String::from("hello world"); 5 | 6 | // BASIC EXAMPLES 7 | // let hello = &s[..5]; // same as [0..5] 8 | // let world = &s[6..]; // [6..11] or [6..len()] 9 | // println!("{} {}", hello, world); 10 | 11 | let first = first_word(&s[..]); 12 | println!("{}", first); 13 | s.clear(); 14 | 15 | // same for int arrays: 16 | let a = [1, 2, 3, 4, 5]; 17 | let slice = &a[1..3]; 18 | } 19 | 20 | fn first_word(s: &str) -> &str { 21 | // str = string slice 22 | let bytes = s.as_bytes(); // convert to array of bytes 23 | for (i, &item) in bytes.iter().enumerate() { 24 | if item == b' ' { 25 | // byte literal 26 | return &s[..i]; 27 | } 28 | } 29 | &s[..] 30 | } 31 | -------------------------------------------------------------------------------- /src/rust_basics/structs.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | struct User { 4 | username: String, 5 | email: String, 6 | sign_in_count: u64, 7 | active: bool, 8 | } 9 | 10 | struct Color(u8, u8, u8); // no need to specify field names 11 | 12 | pub fn main() { 13 | let user1 = User { 14 | email: String::from("email"), 15 | username: String::from("username"), 16 | active: true, 17 | sign_in_count: 3, 18 | }; 19 | 20 | // we can use a spread object operator 21 | let user2 = User { ..user1 }; 22 | let color_white = Color(255, 255, 255); 23 | 24 | let user3 = build_user(user2.email, user2.username); 25 | } 26 | 27 | fn build_user(email: String, username: String) -> User { 28 | User { 29 | email, 30 | username, 31 | active: true, 32 | sign_in_count: 1, 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/challenges/algorithms/solve_me_first.rs: -------------------------------------------------------------------------------- 1 | // Solve Me First 2 | // https://www.hackerrank.com/challenges/solve-me-first 3 | 4 | use std::io; 5 | 6 | pub fn main() { 7 | // variable declaration 8 | let mut _num_str_1 = String::new(); 9 | let mut _num_str_2 = String::new(); 10 | 11 | // read variables 12 | io::stdin() 13 | .read_line(&mut _num_str_1) 14 | .ok() 15 | .expect("read error"); 16 | io::stdin() 17 | .read_line(&mut _num_str_2) 18 | .ok() 19 | .expect("read error"); 20 | 21 | // parse integers 22 | let mut _num_1: i32 = _num_str_1.trim().parse().ok().expect("parse error"); 23 | let mut _num_2: i32 = _num_str_2.trim().parse().ok().expect("parse error"); 24 | 25 | // print the sum 26 | // Hint: Type println!("{}", _num_1 + _num_2); below 27 | println!("{}", _num_1 + _num_2); 28 | } 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hackerrank Challenges in Rust 2 | 3 | [Hackerrank](https://www.hackerrank.com/) challenges solved with the **Rust Programming Language**. 4 | 5 | I am absolutely new to Rust, and I have decided to give it a shot by solving some challenges from Hackerrank. If you are interested and you want to correct or improve my code, please do! :slightly_smiling_face: I would love to see more experienced coders' approaches. 6 | 7 | --- 8 | 9 | #### Instructions 10 | 11 | To run (you need [Rust](https://www.rust-lang.org/) and [Cargo](https://crates.io/) installed): 12 | 13 | ```bash 14 | #!/bin/bash 15 | cargo run 16 | ``` 17 | 18 | You need to change the `main` function with the challenge you would like to run: 19 | 20 | ```rust 21 | // src/main.rs 22 | 23 | mod challenges; 24 | mod functions; 25 | mod rust_basics; 26 | 27 | fn main() { 28 | challenges::thirty_days_of_code::day_00::main(); 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /src/rust_basics/example_guess_game.rs: -------------------------------------------------------------------------------- 1 | use rand::Rng; 2 | use std::cmp::Ordering; 3 | use std::io; 4 | 5 | pub fn main() { 6 | println!("Guess the number!"); 7 | 8 | let secret_number = rand::thread_rng().gen_range(1, 101); 9 | println!("The secret number is: {}", secret_number); 10 | 11 | loop { 12 | println!("Please, input your guess."); 13 | 14 | let mut guess = String::new(); 15 | 16 | io::stdin() 17 | .read_line(&mut guess) 18 | .expect("Failed to read line"); 19 | 20 | let guess: u32 = match guess.trim().parse() { 21 | Ok(num) => num, 22 | Err(_) => continue, 23 | }; 24 | 25 | println!("You guessed: {}", guess); 26 | 27 | match guess.cmp(&secret_number) { 28 | Ordering::Less => println!("Too small!"), 29 | Ordering::Greater => println!("Too big!"), 30 | Ordering::Equal => { 31 | println!("You win!"); 32 | break; 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/rust_basics/vectors.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | enum Coordinates { 4 | North(i32), 5 | East(f64), 6 | South(String), 7 | West(u8), 8 | } 9 | 10 | pub fn main() { 11 | // Example 1 12 | let mut v1 = Vec::new(); 13 | v1.push(1); 14 | v1.push(2); 15 | v1.push(3); 16 | 17 | // Example 2 18 | let v2 = vec![1, 2, 3]; 19 | 20 | // Accessing a value 21 | let third: &i32 = &v2[2]; 22 | match v2.get(2) { 23 | Some(third) => println!("The third value is {}", third), 24 | None => println!("No third element"), 25 | } 26 | 27 | // Iterating 28 | for i in &v2 { 29 | println!("{}", i); 30 | } 31 | 32 | // Iterating over a mutable vector 33 | for i in &mut v1 { 34 | *i += 50; 35 | println!("value: {}", i); 36 | } 37 | 38 | // Vectors and Enums 39 | let coordinates = vec![ 40 | Coordinates::North(64), 41 | Coordinates::East(1.0), 42 | Coordinates::South(String::from("South")), 43 | Coordinates::West(8), 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_03.rs: -------------------------------------------------------------------------------- 1 | // 3. Intro to Conditional Statements 2 | // https://www.hackerrank.com/challenges/30-conditional-statements 3 | 4 | use std::io; 5 | 6 | pub fn main() { 7 | let mut input = String::new(); 8 | 9 | match io::stdin().read_line(&mut input) { 10 | Ok(_) => match input.trim().parse::() { 11 | Ok(n) => { 12 | println!("{}", result(n)); 13 | } 14 | Err(e) => println!("Error!\n{}", e), 15 | }, 16 | Err(e) => println!("Error!\n{}", e), 17 | } 18 | } 19 | 20 | fn result(n: i32) -> String { 21 | 22 | let weird = String::from("Weird"); 23 | let not_weird = String::from("Not Weird"); 24 | 25 | let is_even: bool = n % 2 == 0; 26 | 27 | if !is_even { 28 | return weird; 29 | } 30 | 31 | if is_even && (n >= 2 && n <= 5) { 32 | return not_weird; 33 | } 34 | 35 | if is_even && (n >= 6 && n <= 20) { 36 | return weird; 37 | } 38 | 39 | if is_even && (n < 20) { 40 | return not_weird; 41 | } 42 | 43 | return not_weird; 44 | } -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_20.rs: -------------------------------------------------------------------------------- 1 | // 20. Sorting 2 | // https://www.hackerrank.com/challenges/30-sorting 3 | 4 | #![allow(unused_variables)] 5 | 6 | use crate::functions; 7 | 8 | pub fn main() { 9 | let _ = functions::read_line().trim(); 10 | let input: String = String::from(functions::read_line().trim()); 11 | 12 | let mut row = input 13 | .split(' ') 14 | .into_iter() 15 | .map(|s| s.parse::()) 16 | .collect::, std::num::ParseIntError>>() 17 | .unwrap(); 18 | 19 | println!( 20 | "Array is sorted in {} swaps.", 21 | swaps_from_bubble_sort(&mut row) 22 | ); 23 | println!("First Element: {}", row[0]); 24 | println!("Last Element: {}", row[row.len() - 1]); 25 | } 26 | 27 | fn swaps_from_bubble_sort(vec: &mut Vec) -> i32 { 28 | let mut number_of_swaps = 0; 29 | 30 | for i in 0..vec.len() { 31 | for j in 0..vec.len() - 1 { 32 | if vec[j] > vec[j + 1] { 33 | vec.swap(j, j + 1); 34 | number_of_swaps += 1; 35 | } 36 | } 37 | } 38 | 39 | number_of_swaps 40 | } 41 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_29.rs: -------------------------------------------------------------------------------- 1 | // 29. Bitwise AND 2 | // https://www.hackerrank.com/challenges/30-bitwise-and 3 | 4 | use crate::functions; 5 | 6 | pub fn main() { 7 | let mut test_cases: u32 = match String::from(functions::read_line().trim()).parse::() { 8 | Ok(n) => n, 9 | Err(e) => { 10 | println!("{}", e); 11 | 0 12 | } 13 | }; 14 | 15 | while test_cases > 0 { 16 | let input: Vec = String::from(functions::read_line().trim()) 17 | .split(' ') 18 | .into_iter() 19 | .map(|s| s.parse::()) 20 | .collect::, std::num::ParseIntError>>() 21 | .unwrap(); 22 | 23 | let n = input[0]; 24 | let k = input[1]; 25 | 26 | let mut max = 0; 27 | 28 | for a in 1..n + 1 { 29 | for b in a + 1..n + 1 { 30 | if (a & b) < k { 31 | if max < (a & b) { 32 | max = a & b; 33 | } 34 | } 35 | } 36 | } 37 | println!("{}", max); 38 | test_cases -= 1; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_17.rs: -------------------------------------------------------------------------------- 1 | // 17. More Exceptions 2 | // https://www.hackerrank.com/challenges/30-more-exceptions 3 | // NOTE: When I "solved" this challenge it wasn't available for Rust on Hackerrank. 4 | 5 | use crate::functions; 6 | 7 | pub fn main() { 8 | let mut test_cases: u32 = String::from(functions::read_line().trim()) 9 | .parse::() 10 | .unwrap(); 11 | while test_cases > 1 { 12 | let mut input: Vec = vec![]; 13 | match String::from(functions::read_line().trim()) 14 | .split(' ') 15 | .into_iter() 16 | .map(|s| s.parse::()) 17 | .collect() 18 | { 19 | Ok(v) => { 20 | input = v; 21 | } 22 | Err(_) => { 23 | println!("n and p should be non-negative"); 24 | test_cases -= 1; 25 | continue; 26 | } 27 | }; 28 | println!("{}", myCalculator::power(input[0], input[1])); 29 | test_cases -= 1; 30 | } 31 | } 32 | 33 | struct myCalculator; 34 | impl myCalculator { 35 | fn power(n: u32, p: u32) -> u32 { 36 | n.pow(p) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_14.rs: -------------------------------------------------------------------------------- 1 | // 14. Scope 2 | // https://www.hackerrank.com/challenges/30-scope 3 | // NOTE: When I "solved" this challenge it wasn't available for Rust on Hackerrank. 4 | 5 | use crate::functions; 6 | 7 | pub fn main() { 8 | let _ = String::from(functions::read_line().trim()); 9 | let a: Vec = String::from(functions::read_line().trim()) 10 | .split(' ') 11 | .into_iter() 12 | .map(|s| s.parse::()) 13 | .collect::, std::num::ParseIntError>>() 14 | .unwrap(); 15 | let mut d = Difference { 16 | elements: a, 17 | maximum_difference: 0, 18 | }; 19 | println!("{}", d.compute_difference()); 20 | } 21 | 22 | struct Difference { 23 | elements: Vec, 24 | maximum_difference: i32, 25 | } 26 | 27 | impl Difference { 28 | fn compute_difference(&mut self) -> i32 { 29 | for i in 0..self.elements.len() { 30 | for j in i + 1..self.elements.len() { 31 | let difference = (self.elements[i] - self.elements[j]).abs(); 32 | if difference > self.maximum_difference { 33 | self.maximum_difference = difference; 34 | } 35 | } 36 | } 37 | self.maximum_difference 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_04.rs: -------------------------------------------------------------------------------- 1 | // 4. Class vs. Instance 2 | // https://www.hackerrank.com/challenges/30-class-vs-instance 3 | 4 | #![allow(non_snake_case)] 5 | 6 | use crate::functions; 7 | 8 | struct Person { 9 | age: i32, 10 | } 11 | 12 | impl Person { 13 | fn new(initialAge: i32) -> Person { 14 | if initialAge < 0 { 15 | println!("Age is not valid, setting age to 0."); 16 | return Person { age: 0 }; 17 | } 18 | 19 | return Person { age: initialAge }; 20 | } 21 | 22 | fn amIOld(&self) { 23 | if self.age < 13 { 24 | println!("You are young."); 25 | } else if self.age >= 13 && self.age < 18 { 26 | println!("You are a teenager."); 27 | } else { 28 | println!("You are old."); 29 | } 30 | } 31 | 32 | fn yearPasses(&mut self) { 33 | self.age += 1; 34 | } 35 | } 36 | 37 | pub fn main() { 38 | let T: i32 = functions::read_line().trim().parse().unwrap(); 39 | for _ in 0..T { 40 | let age = functions::read_line().trim().parse().unwrap(); 41 | let mut p = Person::new(age); 42 | p.amIOld(); 43 | for _ in 0..3 { 44 | p.yearPasses(); 45 | } 46 | p.amIOld(); 47 | println!(""); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_28.rs: -------------------------------------------------------------------------------- 1 | // 28. RegEx, Patterns, and Intro to Databases 2 | // https://www.hackerrank.com/challenges/30-regex-patterns 3 | 4 | use crate::functions; 5 | 6 | struct Contact { 7 | name: String, 8 | email: String, 9 | } 10 | 11 | pub fn main() { 12 | let mut number_contacts: u32 = match String::from(functions::read_line().trim()).parse::() 13 | { 14 | Ok(n) => n, 15 | Err(e) => { 16 | println!("{}", e); 17 | 0 18 | } 19 | }; 20 | 21 | let mut gmail_accounts: Vec = vec![]; 22 | 23 | while number_contacts > 0 { 24 | let contact_input: Vec = String::from(functions::read_line().trim()) 25 | .split(' ') 26 | .into_iter() 27 | .map(|s| s.parse::()) 28 | .collect::, std::convert::Infallible>>() 29 | .unwrap(); 30 | let contact = Contact { 31 | name: contact_input[0].clone(), 32 | email: contact_input[1].clone(), 33 | }; 34 | if contact.email.ends_with("@gmail.com") { 35 | gmail_accounts.push(contact.name); 36 | } 37 | number_contacts -= 1; 38 | } 39 | gmail_accounts.sort(); 40 | println!("{}", gmail_accounts.join("\n")); 41 | } 42 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_08.rs: -------------------------------------------------------------------------------- 1 | // 8. Dictionaries and Maps 2 | // https://www.hackerrank.com/challenges/30-dictionaries-and-maps 3 | 4 | use crate::functions; 5 | use std::collections::HashMap; 6 | use std::convert::TryInto; 7 | use std::io; 8 | use std::io::prelude::*; 9 | 10 | pub fn main() { 11 | let t: i32 = functions::read_line().trim().parse().unwrap(); 12 | let stdin = io::stdin(); 13 | let mut phonebook = HashMap::new(); 14 | 15 | for (index, element) in stdin.lock().lines().enumerate() { 16 | // on empty value, break the std read 17 | if element.as_ref().unwrap().is_empty() { 18 | break; 19 | } 20 | let input = element.as_ref().unwrap().trim(); 21 | 22 | // first: building phonebook 23 | if index < t.try_into().unwrap() { 24 | let split_input: Vec<&str> = input.split(" ").collect(); 25 | let name: String = String::from(split_input[0]); 26 | let phone: String = String::from(split_input[1]); 27 | phonebook.insert(name, phone); 28 | } 29 | // now we are reading from stdin and getting results out from pb 30 | else { 31 | if !phonebook.contains_key(input) { 32 | println!("Not found"); 33 | } else { 34 | println!("{}={}", input, phonebook[input]); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/rust_basics/example_rectangle_area.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug)] 2 | 3 | struct Rectangle { 4 | width: u32, 5 | height: u32, 6 | } 7 | 8 | impl Rectangle { 9 | // METHODS 10 | // when they take an instance of their struct (self) 11 | fn area(&self) -> u32 { 12 | self.width * self.height 13 | } 14 | fn can_hold(&self, other: &Rectangle) -> bool { 15 | self.width > other.width && self.height > other.height 16 | } 17 | 18 | // ASSOCIATED FUNCTIONS 19 | // not methods, as they don't take an instance of their struct (like String::from()) 20 | fn square(size: u32) -> Rectangle { 21 | Rectangle { 22 | width: size, 23 | height: size, 24 | } 25 | } 26 | } 27 | 28 | pub fn main() { 29 | let rect1 = Rectangle { 30 | width: 30, 31 | height: 50, 32 | }; 33 | 34 | println!( 35 | "The area of the rectangle is {} square pixels.", 36 | rect1.area() // same as &rect.area() 37 | ); 38 | 39 | let rect2 = Rectangle { 40 | width: 20, 41 | height: 30, 42 | }; 43 | 44 | println!("rect = {:?}", rect1); // {:?} or {:#?} tell println!() we want the Debug trait 45 | 46 | println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2)); 47 | 48 | println!("Associative Method (square): {:#?}", &Rectangle::square(3)); 49 | } 50 | 51 | fn area(rect: &Rectangle) -> u32 { 52 | rect.width * rect.height 53 | } 54 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_25.rs: -------------------------------------------------------------------------------- 1 | // 25. Running Time and Complexity 2 | // https://www.hackerrank.com/challenges/30-running-time-and-complexity 3 | 4 | // use crate::functions; 5 | 6 | pub fn main() { 7 | let mut test_cases: u32 = match String::from(read_line().trim()).parse::() { 8 | Ok(n) => n, 9 | Err(e) => { 10 | println!("{}", e); 11 | 0 12 | } 13 | }; 14 | 15 | while test_cases > 0 { 16 | let n: u32 = String::from(read_line().trim()).parse::().unwrap(); 17 | 18 | let mut flag = false; 19 | 20 | for i in 2..n / 2 { 21 | if n % i == 0 { 22 | flag = true; 23 | break; 24 | } 25 | } 26 | 27 | // a better way? 28 | if n == 4 { 29 | println!("Not prime"); 30 | test_cases -= 1; 31 | continue; 32 | } 33 | 34 | if n != 1 { 35 | if flag == false { 36 | println!("Prime"); 37 | } else { 38 | println!("Not prime"); 39 | } 40 | } else { 41 | println!("Not prime"); 42 | } 43 | 44 | test_cases -= 1; 45 | } 46 | } 47 | 48 | pub fn read_line() -> String { 49 | let mut input = String::new(); 50 | std::io::stdin() 51 | .read_line(&mut input) 52 | .expect("Could not read stdin!"); 53 | return input; 54 | } 55 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_11.rs: -------------------------------------------------------------------------------- 1 | // 11. 2D Arrays 2 | // https://www.hackerrank.com/challenges/30-2d-arrays 3 | 4 | use crate::functions; 5 | 6 | const DIMENSION: usize = 6; 7 | 8 | pub fn main() { 9 | let mut arr = [[0i32; DIMENSION]; DIMENSION]; 10 | 11 | for i in 0..DIMENSION { 12 | let input: String = String::from(functions::read_line().trim()); 13 | 14 | let row = input 15 | .split(' ') 16 | .into_iter() 17 | .map(|s| s.parse::()) 18 | .collect::, std::num::ParseIntError>>() 19 | .unwrap(); 20 | 21 | let mut j = 0; 22 | for value in row { 23 | arr[i][j] = value; 24 | j += 1; 25 | } 26 | } 27 | 28 | let mut max_sum: i32 = 0; 29 | 30 | for i in 0..(DIMENSION - 2) { 31 | for j in 0..(DIMENSION - 2) { 32 | let current_sum: i32 = arr[i][j] 33 | + arr[i][j + 1] 34 | + arr[i][j + 2] 35 | + arr[i + 1][j + 1] 36 | + arr[i + 2][j] 37 | + arr[i + 2][j + 1] 38 | + arr[i + 2][j + 2]; 39 | 40 | if i == 0 && j == 0 { 41 | max_sum = current_sum; 42 | continue; 43 | } 44 | if current_sum > max_sum { 45 | max_sum = current_sum; 46 | } 47 | } 48 | } 49 | 50 | println!("{}", max_sum); 51 | } 52 | -------------------------------------------------------------------------------- /src/challenges/thirty_days_of_code/day_26.rs: -------------------------------------------------------------------------------- 1 | // 26. Nested Logic 2 | // https://www.hackerrank.com/challenges/30-nested-logic 3 | 4 | use crate::functions; 5 | 6 | struct Date { 7 | day: u32, 8 | month: u32, 9 | year: u32, 10 | } 11 | 12 | pub fn main() { 13 | // returned 14 | let input_returned = String::from(functions::read_line().trim()) 15 | .split(' ') 16 | .into_iter() 17 | .map(|s| s.parse::()) 18 | .collect::, std::num::ParseIntError>>() 19 | .unwrap(); 20 | 21 | // expected 22 | let input_expected = String::from(functions::read_line().trim()) 23 | .split(' ') 24 | .into_iter() 25 | .map(|s| s.parse::()) 26 | .collect::, std::num::ParseIntError>>() 27 | .unwrap(); 28 | 29 | let date_returned = Date { 30 | day: input_returned[0], 31 | month: input_returned[1], 32 | year: input_returned[2], 33 | }; 34 | 35 | let date_expected = Date { 36 | day: input_expected[0], 37 | month: input_expected[1], 38 | year: input_expected[2], 39 | }; 40 | 41 | println!("{}", get_fine(date_returned, date_expected)); 42 | } 43 | 44 | fn get_fine(returned: Date, expected: Date) -> u32 { 45 | if returned.year < expected.year { 46 | return 0; 47 | } 48 | if returned.year > expected.year { 49 | return 10000; 50 | } 51 | if returned.month > expected.month { 52 | return (returned.month - expected.month) * 500; 53 | } 54 | if returned.day > expected.day { 55 | return (returned.day - expected.day) * 15; 56 | } 57 | 0 58 | } 59 | -------------------------------------------------------------------------------- /src/rust_basics/references.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | println!("REFERENCES + BORROWING"); 3 | { 4 | // having references as function parameters is called BORROWING 5 | let s1 = String::from("hello"); 6 | let len = calculate_length(&s1); // references allow to refere to a value, without taking its ownership 7 | println!("s1.len() = {}", len); 8 | // * is the opposite: dereferencing) 9 | } 10 | println!(); 11 | 12 | // ---------------------- 13 | 14 | println!("MUTABLE REFERENCES"); 15 | { 16 | let mut s = String::from("hello"); 17 | mutable_reference(&mut s); 18 | println!("s = {}", s); 19 | // we can only have one mutable reference of a variable: { 20 | // let mut s = String::from("hello"); 21 | // let r1 = &mut s; 22 | // let r2 = &mut s; 23 | // println!("{}, {}", r1, r2); 24 | // } 25 | 26 | // we can only have either ONE mutable reference or ONE immutable (not both) 27 | // but we can have MULTIPLE immutable references: { 28 | // let mut s = String::from("hello"); 29 | // let r1 = &s; 30 | // let r2 = &s; 31 | // let r3 = &mut s; 32 | // println!("{}, {}, {}", r1, r2, r3); 33 | // } 34 | } 35 | println!(); 36 | } 37 | 38 | fn calculate_length(s: &String) -> usize { 39 | // s.push_str("example"); // not valid: references are not mutable by default (like variables) 40 | s.len() 41 | } // as it doesn't have ownership of the value passed, nothing happens 42 | 43 | fn mutable_reference(s: &mut String) { 44 | s.push_str(", world"); 45 | } 46 | -------------------------------------------------------------------------------- /src/rust_basics/enums.rs: -------------------------------------------------------------------------------- 1 | #![allow(unused_variables)] 2 | 3 | // this file also covers the Match pattern and Option 4 | 5 | enum SimpleEnum { 6 | Enum1(String), 7 | Enum2(String), 8 | } 9 | 10 | enum Message { 11 | Quit, 12 | Move { x: i32, y: i32 }, 13 | Write(String), 14 | ChangeColor(i32, i32, i32), 15 | } 16 | 17 | // enums can have methods :O 18 | impl Message { 19 | fn call(&self) { 20 | // method body 21 | } 22 | } 23 | 24 | enum Coin { 25 | Penny, 26 | Nickel, 27 | Dime, 28 | Quarter, 29 | } 30 | 31 | pub fn main() { 32 | println!(); 33 | 34 | // Option Examples: 35 | let some_number = Some(5); 36 | let some_string = Some("a string"); 37 | let absent_number: Option = None; 38 | 39 | let x: i8 = 5; 40 | let y: Option = Some(5); 41 | 42 | // Matching Examples: 43 | println!("Matching a Option:"); 44 | // invalid! can't add i8 with Option 45 | // let sum = x + y; 46 | 47 | // we would have to do it like follows: 48 | let sum = match y { 49 | Some(n) => n + x, 50 | None => 0, 51 | }; 52 | println!("The sum equals to: {}", sum); 53 | 54 | println!(); 55 | println!( 56 | "Value of a Quarter in cents: {}", 57 | value_in_cents(Coin::Quarter) 58 | ); 59 | 60 | let five = Some(5); 61 | let six = plus_one(five); 62 | let none = plus_one(None); 63 | 64 | let some_u8_value = 0u8; 65 | match some_u8_value { 66 | 1 => println!("one"), 67 | 2 => println!("two"), 68 | 3 => println!("three"), 69 | 4 => println!("four"), 70 | _ => (), // placeholder 71 | }; 72 | 73 | // IF LET 74 | let some_value = Some(0u8); 75 | if let Some(3) = some_value { 76 | println!("three"); 77 | } 78 | } 79 | 80 | fn value_in_cents(coin: Coin) -> u8 { 81 | match coin { 82 | Coin::Penny => 1, 83 | Coin::Nickel => 5, 84 | Coin::Dime => 10, 85 | Coin::Quarter => 25, 86 | } 87 | } 88 | 89 | fn plus_one(x: Option) -> Option { 90 | match x { 91 | None => None, 92 | Some(i) => Some(i + 1), 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/rust_basics/ownership.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | // ---------------------- 3 | // -------- MOVE -------- 4 | // ---------------------- 5 | println!("MOVE EXAMPLE:"); 6 | { 7 | // the data from s1 is not copied to s2 8 | let s1 = String::from("hello"); 9 | let s2 = s1; 10 | // println!("{}", s1); // and it won't work to use s1: 11 | println!("{}", s2); // but will work with s2 12 | 13 | // it becomes a problem if both strings are pointing to the same allocated memory 14 | // ^-- this is called: move 15 | } 16 | println!(); 17 | 18 | // ----------------------- 19 | // -------- CLONE -------- 20 | // ----------------------- 21 | println!("CLONE EXAMPLE:"); 22 | { 23 | let mut s1 = String::from("hello"); 24 | let mut s2 = s1.clone(); 25 | s1.push_str(" s1"); 26 | s2.push_str(" s2"); 27 | println!("s1 = {}, s2 = {}", s1, s2); 28 | } 29 | println!(); 30 | 31 | // ---------------------- 32 | // -------- COPY -------- 33 | // ---------------------- 34 | println!("COPY EXAMPLE:"); 35 | { 36 | // we didn't need to clone() this, because it is an integer. 37 | // integer's sizes are known at compile time, and are stored on the stack. 38 | let x = 5; 39 | let y = x; 40 | println!("x = {}, y = {}", x, y); 41 | } 42 | println!(); 43 | 44 | // ---------------------- 45 | 46 | println!("OWNERSHIP + FUNCTIONS"); 47 | { 48 | let s = String::from("hello"); 49 | takes_ownership(s); 50 | // println!("{}", s); // s no longer valid here... 51 | 52 | let x = 5; 53 | makes_copy(x); 54 | println!("{}", x); // because x is , we can still use it here 55 | } 56 | println!(); 57 | 58 | // ---------------------- 59 | 60 | println!("WITH RETURN VALUES"); 61 | { 62 | let s1 = gives_ownership(); 63 | 64 | let s2 = String::from("hello"); 65 | let s3 = takes_and_gives_ownership(s2); 66 | 67 | println!("s1 = {}, s2 = not available, s3 = {}", s1, s3); 68 | } 69 | println!(); 70 | } 71 | 72 | fn takes_ownership(some_string: String) { 73 | println!("some_string = {}", some_string); 74 | } // here "some_string" is dropped 75 | 76 | fn makes_copy(some_integer: i32) { 77 | println!("some_integer = {}", some_integer); 78 | } // here "some_integer" is just out of scope, and not freed 79 | 80 | fn gives_ownership() -> String { 81 | let some_string = String::from("hello"); 82 | some_string 83 | } 84 | 85 | fn takes_and_gives_ownership(a_string: String) -> String { 86 | a_string 87 | } 88 | 89 | // now, if we want to pass a value onto a fn, 90 | // and the continue using it afterwards, 91 | // we need to use references (&) 92 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "fuchsia-cprng" 5 | version = "0.1.1" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | 8 | [[package]] 9 | name = "hackerrank-challenges-rust" 10 | version = "0.1.0" 11 | dependencies = [ 12 | "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", 13 | ] 14 | 15 | [[package]] 16 | name = "libc" 17 | version = "0.2.66" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | 20 | [[package]] 21 | name = "rand" 22 | version = "0.3.23" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | dependencies = [ 25 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 26 | "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 27 | ] 28 | 29 | [[package]] 30 | name = "rand" 31 | version = "0.4.6" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | dependencies = [ 34 | "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 35 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 36 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 37 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 39 | ] 40 | 41 | [[package]] 42 | name = "rand_core" 43 | version = "0.3.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | dependencies = [ 46 | "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 47 | ] 48 | 49 | [[package]] 50 | name = "rand_core" 51 | version = "0.4.2" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | 54 | [[package]] 55 | name = "rdrand" 56 | version = "0.4.0" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | dependencies = [ 59 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 60 | ] 61 | 62 | [[package]] 63 | name = "winapi" 64 | version = "0.3.8" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | dependencies = [ 67 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 68 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 69 | ] 70 | 71 | [[package]] 72 | name = "winapi-i686-pc-windows-gnu" 73 | version = "0.4.0" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | 76 | [[package]] 77 | name = "winapi-x86_64-pc-windows-gnu" 78 | version = "0.4.0" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | 81 | [metadata] 82 | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" 83 | "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" 84 | "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" 85 | "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" 86 | "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" 87 | "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" 88 | "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 89 | "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 90 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 91 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 92 | --------------------------------------------------------------------------------