diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/max_ice_cream_bars.rs | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/max_ice_cream_bars.rs')
-rw-r--r-- | other/max_ice_cream_bars.rs | 27 |
1 files changed, 0 insertions, 27 deletions
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<i32>, 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 -} |