use std::convert::TryInto; pub fn two_sum(numbers: Vec, target: i32) -> Vec { for (index_1, number_1) in numbers.iter().enumerate() { for (index_2, number_2) in numbers.iter().enumerate() { if index_1 == index_2 { continue; } if number_1 + number_2 == target { return vec![index_1.try_into().unwrap(), index_2.try_into().unwrap()]; } } } unreachable!() }