Given a list of non negative integers, arrange them such that they form the largest number.
Input: [10,2] Output: "210"
Input: [3,30,34,5,9] Output: "9534330"
Note: The result may be very large, so you need to return a string instead of an integer.
impl Solution {
pub fn largest_number(nums: Vec<i32>) -> String {
let mut nums = nums.iter().map(|num| num.to_string()).collect::<Vec<_>>();
nums.sort_unstable_by(|a, b| (b.to_owned() + a).cmp(&(a.to_owned() + b)));
if nums.len() > 0 && nums[0] == 0.to_string() {
return 0.to_string();
}
nums.concat()
}
}