Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Output the largest number with the fewest digits

Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits.

The input list will not be in any particular order and may contain repeated values.

Examples:

[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938

The shortest code in bytes wins.

Answer*

Draft saved
Draft discarded
Cancel
2
  • \$\begingroup\$ 15 bytes: /↥⊏⊚=⊸/↧⊸≡(⧻°⋕) \$\endgroup\$ Commented Nov 7 at 15:04
  • 1
    \$\begingroup\$ @ojdo 14 bytes: ⊣⊏⊚=⊸⊢⊸≡(⧻°⋕)⍆ \$\endgroup\$ Commented Nov 9 at 7:09

AltStyle によって変換されたページ (->オリジナル) /