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/remove_stones.rs | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/remove_stones.rs')
-rw-r--r-- | other/remove_stones.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/other/remove_stones.rs b/other/remove_stones.rs deleted file mode 100644 index e55eade..0000000 --- a/other/remove_stones.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::collections::BinaryHeap; -struct Solution; - -impl Solution { - pub fn min_stone_sum(piles: Vec<i32>, mut k: i32) -> i32 { - let mut max_heap = BinaryHeap::<i32>::new(); - for i in piles { - max_heap.push(i); - } - while k > 0 { - if let Some(top) = max_heap.pop() { - let removed = top - top / 2; - max_heap.push(removed); - } - k -= 1; - } - max_heap.iter().sum() - } -} - -fn main() { - let piles1 = vec![5,4,9]; - let piles2 = vec![4,3,6,7]; - println!("{}", Solution::min_stone_sum(piles1, 2)); //expect: 12 - println!("{}", Solution::min_stone_sum(piles2, 3)); //expect: 12 -} |