Created
March 2, 2025 20:34
-
-
Save mrbus/05c0a67a518fceb05fc14877282b21d6 to your computer and use it in GitHub Desktop.
Rust Developer Intern - Task 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
pub fn get_score(game_stamps: &[Stamp], offset: i32) -> (i32, i32) { | |
// Using binary search because the vector is sorted by offset | |
let found_index = game_stamps.binary_search_by_key(&offset, |s| s.offset).unwrap(); | |
(game_stamps[found_index].score.home, game_stamps[found_index].score.away) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment