From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/max_ice_cream_bars.rs | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 other/max_ice_cream_bars.rs (limited to 'other/max_ice_cream_bars.rs') diff --git a/other/max_ice_cream_bars.rs b/other/max_ice_cream_bars.rs deleted file mode 100644 index 6691a3b..0000000 --- a/other/max_ice_cream_bars.rs +++ /dev/null @@ -1,27 +0,0 @@ -struct Solution; - -impl Solution { - pub fn max_ice_cream(costs: Vec, coins: i32) -> i32 { - let (mut bars, mut coins, mut price, mut count) = - ([0_u32; 100_001], coins, 1, 0); - costs.into_iter().for_each(|c| bars[c as usize] += 1); - while coins >= price && price <= 100_000 { - while bars[price as usize] > 0 && coins >= price { - bars[price as usize] -= 1; - coins -= price; - count += 1; - } - price += 1; - } - count - } -} - -fn main() { - let costs1 = vec![1,3,2,4,1]; - let costs2 = vec![10,6,8,7,7,8]; - let costs3 = vec![1,6,3,1,2,5]; - println!("{}", Solution::max_ice_cream(costs1, 7)); //expect: 4 - println!("{}", Solution::max_ice_cream(costs2, 5)); //expect: 0 - println!("{}", Solution::max_ice_cream(costs3, 20)); //expect: 6 -} -- cgit v1.2.3