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

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

05AB1E , (削除) 13 (削除ここまで) 12 bytes

Tsãʒ1ÛSO2‹}C{

-1 byte thanks to @Grimy (also take a look at his shorter approach here).

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 ! # Check that the sum is either 0 or 1 by taking the factorial
 # (NOTE: Only 1 is truthy in 05AB1E)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)

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

Tsãʒ1ÛSO2‹}C{

-1 byte thanks to @Grimy (also take a look at his shorter approach here).

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 ! # Check that the sum is either 0 or 1 by taking the factorial
 # (NOTE: Only 1 is truthy in 05AB1E)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)

05AB1E , (削除) 13 (削除ここまで) 12 bytes

Tsãʒ1ÛSO2‹}C{

-1 byte thanks to @Grimy (also take a look at his shorter approach here).

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 ! # Check that the sum is either 0 or 1 by taking the factorial
 # (NOTE: Only 1 is truthy in 05AB1E)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)
added 139 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

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

Tsãʒ1ÛSO2‹}C{

Try it online -1 byte thanks to @Grimy (also take a look at his shorter approach here).

Try it online or verify all test cases verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 2‹! # And checkCheck that it's smaller thanthe 2sum (sois either 0 or 1) by taking the factorial
 #  (NOTE: Only 1 is truthy in 05AB1E)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)

#05AB1E, 13 bytes

Tsãʒ1ÛSO2‹}C{

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 2‹ # And check that it's smaller than 2 (so either 0 or 1)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)

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

Tsãʒ1ÛSO2‹}C{

-1 byte thanks to @Grimy (also take a look at his shorter approach here).

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 ! # Check that the sum is either 0 or 1 by taking the factorial
 #  (NOTE: Only 1 is truthy in 05AB1E)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#05AB1E, 13 bytes

Tsãʒ1ÛSO2‹}C{

Try it online or verify all test cases.

Explanation:

T # Push 10
 sã # Swap to get the (implicit) input, and get the cartesian product with "10"
 ʒ # Filter it by:
 1Û # Remove leading 1s
 SO # Get the sum of the remaining digits
 2‹ # And check that it's smaller than 2 (so either 0 or 1)
 }C # After the filter: convert all remaining strings from binary to integer
 { # And sort (reverse) them
 # (after which the result is output implicitly)

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