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
| #[test] | |
| fn tests() { | |
| #[rustfmt::skip] | |
| let matrix = vec![ | |
| vec![1 , 2 , 3, 4 , 5], | |
| vec![6 , 7 , 8, 9 , 10], | |
| vec![11 , 12 , 13, 14 , 15], | |
| vec![16 , 17 , 18, 19 , 20], | |
| ]; | |
| let res = zigzag(&matrix); |
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
| #[test] | |
| fn triangle_test() { | |
| cycle_triangle(10); | |
| } | |
| fn cycle_triangle(base: i32) { | |
| // if base even we know final column is 2 so -> (base -2*k) = 2 | |
| // if base odd we know final column is 1 so -> (base -2*k) = 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
| #[test] | |
| pub fn decode_test() { | |
| let decoded = decode_hex("EF1C9D9E"); | |
| print!("decoded = {:?} = ",decoded); | |
| print_hex(&decoded); | |
| let decoded = encode_hex(decoded); | |
| println!("encoded = '{}'", decoded); | |
| } |