Skip to main content
Commonmark migration
Source Link

Braingolf, 15 bytes

k&gG{!L1-?$_|}X

Try it online!

Takes input as a list of digits

##Explanation

Explanation

k&gG{!L1-?$_|}X  Implicit input from commandline args
k                Sort in descending numerical order
 &g              Combine into single integer
   G             Split into digit runs
    {........}   Foreach loop..
     !L1-?       ..If length of item is greater than 1..
          $_     ....Remove item
            |    ..Endif
              X  Select highest value
                 Implicit output

To help visualize it a little, here's a run through showing the stack with input 122355567679

k&gG{!L1-?$_|}X  [1,2,2,3,5,5,5,6,7,6,7,9]
k                [9,7,7,6,6,5,5,5,3,2,2,1]
 &g              [977665553221]
   G             [9,77,66,555,3,22,1]
    {!L1-?$_|}   [9,3,1]
              X  [9]

Braingolf, 15 bytes

k&gG{!L1-?$_|}X

Try it online!

Takes input as a list of digits

##Explanation

k&gG{!L1-?$_|}X  Implicit input from commandline args
k                Sort in descending numerical order
 &g              Combine into single integer
   G             Split into digit runs
    {........}   Foreach loop..
     !L1-?       ..If length of item is greater than 1..
          $_     ....Remove item
            |    ..Endif
              X  Select highest value
                 Implicit output

To help visualize it a little, here's a run through showing the stack with input 122355567679

k&gG{!L1-?$_|}X  [1,2,2,3,5,5,5,6,7,6,7,9]
k                [9,7,7,6,6,5,5,5,3,2,2,1]
 &g              [977665553221]
   G             [9,77,66,555,3,22,1]
    {!L1-?$_|}   [9,3,1]
              X  [9]

Braingolf, 15 bytes

k&gG{!L1-?$_|}X

Try it online!

Takes input as a list of digits

Explanation

k&gG{!L1-?$_|}X  Implicit input from commandline args
k                Sort in descending numerical order
 &g              Combine into single integer
   G             Split into digit runs
    {........}   Foreach loop..
     !L1-?       ..If length of item is greater than 1..
          $_     ....Remove item
            |    ..Endif
              X  Select highest value
                 Implicit output

To help visualize it a little, here's a run through showing the stack with input 122355567679

k&gG{!L1-?$_|}X  [1,2,2,3,5,5,5,6,7,6,7,9]
k                [9,7,7,6,6,5,5,5,3,2,2,1]
 &g              [977665553221]
   G             [9,77,66,555,3,22,1]
    {!L1-?$_|}   [9,3,1]
              X  [9]
Source Link
Mayube
  • 11.7k
  • 2
  • 48
  • 93

Braingolf, 15 bytes

k&gG{!L1-?$_|}X

Try it online!

Takes input as a list of digits

##Explanation

k&gG{!L1-?$_|}X  Implicit input from commandline args
k                Sort in descending numerical order
 &g              Combine into single integer
   G             Split into digit runs
    {........}   Foreach loop..
     !L1-?       ..If length of item is greater than 1..
          $_     ....Remove item
            |    ..Endif
              X  Select highest value
                 Implicit output

To help visualize it a little, here's a run through showing the stack with input 122355567679

k&gG{!L1-?$_|}X  [1,2,2,3,5,5,5,6,7,6,7,9]
k                [9,7,7,6,6,5,5,5,3,2,2,1]
 &g              [977665553221]
   G             [9,77,66,555,3,22,1]
    {!L1-?$_|}   [9,3,1]
              X  [9]