Skip to content

Commit

Permalink
Sync LeetCode submission - Maximum Element After Decreasing and Rearr…
Browse files Browse the repository at this point in the history
…anging (rust)
  • Loading branch information
hucancode committed Nov 15, 2023
1 parent a0bf7ca commit 83ba9ef
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
impl Solution {
pub fn maximum_element_after_decrementing_and_rearranging(mut arr: Vec<i32>) -> i32 {
arr.sort();
arr.into_iter().fold(0, |acc,x| std::cmp::min(acc+1, x))
}
}

0 comments on commit 83ba9ef

Please sign in to comment.