Binary Search (Rust)
Topics: search, algorithms
Problem
nums is sorted ascending. Return Some(index) of target, or None if it isn't present, in
O(log n) time.
search(&[1, 3, 5, 7, 9], 7) // Some(3)
search(&[1, 3, 5, 7, 9], 4) // None
Grading
Your solution.rs is compiled together with a trusted tests.rs (which include!s it) using
rustc --test. Only solution.rs is yours to edit.
Sign in to submit your solution.