A promo banner is built by placing number stickers side by side. nums lists the stickers' values, and every sticker must be used exactly once. The marketing team wants the arrangement that reads as the biggest possible number.
Write biggestBanner(nums) that returns that number as a string (it can be too long for a JavaScript number). If the result would have leading zeros, return just "0".
Input: nums = [10,2] Output: "210"
"2" + "10" is "210", bigger than "102".
Input: nums = [4,40,45,7,8] Output: "8745440"
4 goes before 40 because "440" beats "404".
1 <= nums.length <= 10000 <= nums[i] <= 10^9Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #220 Biggest Banner Number. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.