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

Return to Answer

Commonmark migration
Source Link

#Pyth, (削除) 13 (削除ここまで) 12 bytes

Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p

#Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p

Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p

Saved a byte, added explanation
Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

*Edit: Saved a byte by taking stringification out of the mapping function. Previous version: ``Edit: Saved a byte by taking stringification out of the mapping function. Previous version:hM_BSmvs`Md.p

#Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

*Edit: Saved a byte by taking stringification out of the mapping function. Previous version: ``

#Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

Edit: Saved a byte by taking stringification out of the mapping function. Previous version:hM_BSmvs`Md.p

Saved a byte, added explanation
Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, 13(削除) 13 (削除ここまで) 12 bytes

hM_BSmvs`MdhM_BSvsM.pp`M

Outputs in form [smallest, largest]. Try it online here here, or verify all the test cases at once here here .

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

*Edit: Saved a byte by taking stringification out of the mapping function. Previous version: ``

#Pyth, 13 bytes

hM_BSmvs`Md.p

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.

#Pyth, (削除) 13 (削除ここまで) 12 bytes

hM_BSvsM.p`M

Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here .

hM_BSvsM.p`MQ Implicit: Q=eval(input())
 Trailing Q inferred
 `MQ Stringify all elements of Q
 .p Generate all permutations of the above
 sM Concatenate each permutation
 v Evaluate each as a number
 S Sort them
 _B Pair the sorted list with its reverse
hM Take the first element of each, implicit print

*Edit: Saved a byte by taking stringification out of the mapping function. Previous version: ``

Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30
Loading

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