You are viewing a single comment's thread. Return to all comments →
Awesome rust solution ;)
fn maximumPerimeterTriangle(mut sticks: Vec<i32>) -> Vec<i32> { sticks.sort(); sticks .windows(3) .filter(|&window| window[0] + window[1] > window[2]) .max_by_key(|&window| (window.iter().sum::<i32>(), window.iter().min().unwrap())) .unwrap_or(&[-1]) .to_vec() }
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Perimeter Triangle
You are viewing a single comment's thread. Return to all comments →
Awesome rust solution ;)