Skip to content

Instantly share code, notes, and snippets.

@mrbus
Created March 2, 2025 20:34
Show Gist options
  • Save mrbus/05c0a67a518fceb05fc14877282b21d6 to your computer and use it in GitHub Desktop.
Save mrbus/05c0a67a518fceb05fc14877282b21d6 to your computer and use it in GitHub Desktop.
Rust Developer Intern - Task 1
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