GoLang Solution For LeetCode Problem: Largest Number
Solving Largest Number in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
Problem Description
Given a list of non negative integers, arrange them such that they form the largest number.
Example 1:
Input: [10,2]
Output: "210"
Example 2:
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.
aStr := a + b
bStr := b + a
aStr := "3" + "30" = "330"
bStr := "30" + "3" = "303"
See the full details of the problem Largest Number at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.