179. Largest Number Medium

@problem@discussion
#String#Greedy#Sorting



1/**
2 * [179] Largest Number
3 *
4 * Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.
5 * Since the result may be very large, so you need to return a string instead of an integer.
6 *  
7 * Example 1:
8 * 
9 * Input: nums = [10,2]
10 * Output: "210"
11 * 
12 * Example 2:
13 * 
14 * Input: nums = [3,30,34,5,9]
15 * Output: "9534330"
16 * 
17 *  
18 * Constraints:
19 * 
20 * 	1 <= nums.length <= 100
21 * 	0 <= nums[i] <= 10^9
22 * 
23 */
24pub struct Solution {}
25
26// problem: https://leetcode.com/problems/largest-number/
27// discuss: https://leetcode.com/problems/largest-number/discuss/?currentPage=1&orderBy=most_votes&query=
28
29// submission codes start here
30
31impl Solution {
32    pub fn largest_number(nums: Vec<i32>) -> String {
33        String::new()
34    }
35}
36
37// submission codes end
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_179() {
45    }
46}
47


Back
© 2025 bowen.ge All Rights Reserved.