1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00
LeetCode/rs/squares-of-a-sorted-array.rs

11 lines
189 B
Rust
Raw Normal View History

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