You are viewing a single comment's thread. Return to all comments →
My rust solution:
fn sockMerchant(n: i32, ar: &[i32]) -> i32 { let odd_socks = ar.iter().fold(HashSet::new(), |mut acc, sock| { if acc.remove(sock) == false { acc.insert(sock); } acc }) .len() as i32; (n - odd_socks) / 2 }
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
My rust solution: