1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-14 01:49:41 +01:00

rs: add «977. Squares of a Sorted Array»

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2024-03-02 12:57:58 +01:00
parent 8d4fc53789
commit 668057d19c
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -0,0 +1,10 @@
impl Solution {
pub fn sorted_squares(mut nums: Vec<i32>) -> Vec<i32> {
for x in &mut nums {
*x *= *x;
}
nums.sort_unstable();
nums
}
}