Skip to main content
Commonmark migration
Source Link

#K4, 22 21 bytes

K4, 22 21 bytes

Solution:

"c"$2/:'0N 8#?/0 2_x:

Example:

q)k)"c"$2/:'0N 8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#?/0 2_x: / the solution
                  x:  / save input as x
               0 2_   / cut x at 0 and 2nd index
             ?/       / lookup (?) over (/)
        0N 8#         / reshape into 8-long rows
    2/:'              / decode (/:) each (') from base 2
"c"$                  / cast to character

Notes:

  • -1 byte thanks to ngn!

#K4, 22 21 bytes

Solution:

"c"$2/:'0N 8#?/0 2_x:

Example:

q)k)"c"$2/:'0N 8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#?/0 2_x: / the solution
                  x:  / save input as x
               0 2_   / cut x at 0 and 2nd index
             ?/       / lookup (?) over (/)
        0N 8#         / reshape into 8-long rows
    2/:'              / decode (/:) each (') from base 2
"c"$                  / cast to character

Notes:

  • -1 byte thanks to ngn!

K4, 22 21 bytes

Solution:

"c"$2/:'0N 8#?/0 2_x:

Example:

q)k)"c"$2/:'0N 8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#?/0 2_x: / the solution
                  x:  / save input as x
               0 2_   / cut x at 0 and 2nd index
             ?/       / lookup (?) over (/)
        0N 8#         / reshape into 8-long rows
    2/:'              / decode (/:) each (') from base 2
"c"$                  / cast to character

Notes:

  • -1 byte thanks to ngn!
-1 byte thanks to ngn
Source Link
mkst
  • 5.2k
  • 12
  • 19

#K4, 2222 21 bytes

Solution:

"c"$2/:'0N 8#x[1]=2_x8#?/0 2_x:

Example:

q)k)"c"$2/:'0N 8#x[1]=2_x8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#x[1]=2_x8#?/0 2_x: / the solution
                    x:  / save input as x
                 0 2_   / drop first 2 chars
     cut x at 0 and 2nd index
      =     / equal to?
            / x[1]      / index into xlookup at(?) positionover 1(/)
        0N 8#          / reshape into 8-long rows
    2/:'               / decode (/:) each (') from base 2
"c"$                   / cast to character

Notes:

  • -1 byte thanks to ngn!

#K4, 22 bytes

Solution:

"c"$2/:'0N 8#x[1]=2_x:

Example:

q)k)"c"$2/:'0N 8#x[1]=2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#x[1]=2_x: / the solution
                    x: / save input as x
                  2_   / drop first 2 chars
                 =     / equal to?
             x[1]      / index into x at position 1
        0N 8#          / reshape into 8-long rows
    2/:'               / decode (/:) each (') from base 2
"c"$                   / cast to character

#K4, 22 21 bytes

Solution:

"c"$2/:'0N 8#?/0 2_x:

Example:

q)k)"c"$2/:'0N 8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#?/0 2_x: / the solution
                  x:  / save input as x
               0 2_   / cut x at 0 and 2nd index
             ?/       / lookup (?) over (/)
        0N 8#         / reshape into 8-long rows
    2/:'              / decode (/:) each (') from base 2
"c"$                  / cast to character

Notes:

  • -1 byte thanks to ngn!
Source Link
mkst
  • 5.2k
  • 12
  • 19

#K4, 22 bytes

Solution:

"c"$2/:'0N 8#x[1]=2_x:

Example:

q)k)"c"$2/:'0N 8#x[1]=2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:

Evaluated right-to-left:

"c"$2/:'0N 8#x[1]=2_x: / the solution
                    x: / save input as x
                  2_   / drop first 2 chars
                 =     / equal to?
             x[1]      / index into x at position 1
        0N 8#          / reshape into 8-long rows
    2/:'               / decode (/:) each (') from base 2
"c"$                   / cast to character