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

#Stax , 11 bytes CP437

Stax , 11 bytes CP437

ä¢⌠┐xntH↔BU

Try it online!

Unpacked version with 13 bytes:

B|AsF:10i^\=*

Finally tied Husk and beaten by Jelly by just one byte ...

Explanation

B Push tail (all except 1st row) of the input array, then push the head (1st row)
 |A All elements in the head are truthy
 This will be used as an accumulator
 sF For each element in the tail, execute the rest of the program
 :1 All truthy indices
 0i^\ Expected truthy indices (0 and the current row number)
 = The truthy indices are as expected
 * Perform logical "and" with the accumulator
 Implicit output of the final accumulator

#Stax , 11 bytes CP437

ä¢⌠┐xntH↔BU

Try it online!

Unpacked version with 13 bytes:

B|AsF:10i^\=*

Finally tied Husk and beaten by Jelly by just one byte ...

Explanation

B Push tail (all except 1st row) of the input array, then push the head (1st row)
 |A All elements in the head are truthy
 This will be used as an accumulator
 sF For each element in the tail, execute the rest of the program
 :1 All truthy indices
 0i^\ Expected truthy indices (0 and the current row number)
 = The truthy indices are as expected
 * Perform logical "and" with the accumulator
 Implicit output of the final accumulator

Stax , 11 bytes CP437

ä¢⌠┐xntH↔BU

Try it online!

Unpacked version with 13 bytes:

B|AsF:10i^\=*

Finally tied Husk and beaten by Jelly by just one byte ...

Explanation

B Push tail (all except 1st row) of the input array, then push the head (1st row)
 |A All elements in the head are truthy
 This will be used as an accumulator
 sF For each element in the tail, execute the rest of the program
 :1 All truthy indices
 0i^\ Expected truthy indices (0 and the current row number)
 = The truthy indices are as expected
 * Perform logical "and" with the accumulator
 Implicit output of the final accumulator
Rollback to Revision 1
Source Link
Weijun Zhou
  • 3.7k
  • 15
  • 42

#Stax, 1511 bytes CP437

Çoφ╕é┘`2x|◙╘▓╠█ä¢⌠┐xntH↔BU

Try it online! Try it online!

Unpacked version with 1713 bytes:

Z+{|e}({Bsr+mB|AsF:fDm10i^\=*

Longer than I expectedFinally tied Husk and beaten by Jelly by just one byte ...

Explanation

Z+{|e}({Bsr+m:fDmB P
Z+  Push tail (all except 1st row) Prependsof the input array, withthen apush zero
the head {|e}(1st row)
 |A Separate array intoAll partselements in the head are truthy
 This will be used as an accumulator
 Each partsF starts with an even number, followed by a run of odd numbers
For each element in the tail, execute the {rest of the program
 m :1 For each part
 All truthy indices
 Bsr+ 0i^\ Reverse the oddExpected runtruthy andindices keep(0 and the headingcurrent evenrow number intact)
 = :fD The truthy Flattenindices theare nestedas arrayexpected
 and remove the heading zero
 * Perform logical "and" with the maccumulator
 Print the array, one element per line.
 Implicit output of the final accumulator

#Stax, 15 bytes CP437

Çoφ╕é┘`2x|◙╘▓╠█

Try it online!

Unpacked version with 17 bytes:

Z+{|e}({Bsr+m:fDm

Longer than I expected ...

Explanation

Z+{|e}({Bsr+m:fDm P
Z+  Prepends the array with a zero
 {|e}( Separate array into parts
 Each part starts with an even number, followed by a run of odd numbers
 { m For each part
 Bsr+ Reverse the odd run and keep the heading even number intact
 :fD Flatten the nested array and remove the heading zero
 m Print the array, one element per line.
 

#Stax, 11 bytes CP437

ä¢⌠┐xntH↔BU

Try it online!

Unpacked version with 13 bytes:

B|AsF:10i^\=*

Finally tied Husk and beaten by Jelly by just one byte ...

Explanation

B Push tail (all except 1st row) of the input array, then push the head (1st row)
 |A All elements in the head are truthy
 This will be used as an accumulator
 sF For each element in the tail, execute the rest of the program
 :1 All truthy indices
 0i^\ Expected truthy indices (0 and the current row number)
 = The truthy indices are as expected
 * Perform logical "and" with the accumulator
 Implicit output of the final accumulator
deleted 697 characters in body
Source Link
Weijun Zhou
  • 3.7k
  • 15
  • 42

#Stax, 1115 bytes CP437

ä¢⌠┐xntH↔BUÇoφ╕é┘`2x|◙╘▓╠█

Try it online! Try it online!

Unpacked version with 1317 bytes:

B|AsFZ+{|e}({Bsr+m:10i^\=*fDm

Finally tied Husk and beaten by Jelly by just one byteLonger than I expected ...

Explanation

BZ+{|e}({Bsr+m:fDm P
Z+ Push tail (all except 1st row) of thePrepends inputthe array, then push the headwith (1sta row)zero
 |A  {|e}( All elements in theSeparate headarray areinto truthyparts
 This will be used as an accumulator
 sF Each part starts with an even number, followed by a Forrun eachof elementodd innumbers
 the tail, execute the rest of the{ program
 m :1 For each part
 All truthy indices
 Bsr+ 0i^\ ExpectedReverse truthythe indicesodd (0run and keep the currentheading roweven number)
 intact
 = :fD The truthy indices areFlatten asthe expected
nested array and remove the heading zero
 * Perform logical "and" with the accumulator
 m Print the array, one element per line.
 Implicit output of the final accumulator

#Stax, 11 bytes CP437

ä¢⌠┐xntH↔BU

Try it online!

Unpacked version with 13 bytes:

B|AsF:10i^\=*

Finally tied Husk and beaten by Jelly by just one byte ...

Explanation

B Push tail (all except 1st row) of the input array, then push the head (1st row)
 |A  All elements in the head are truthy
 This will be used as an accumulator
 sF For each element in the tail, execute the rest of the program
 :1 All truthy indices
 0i^\ Expected truthy indices (0 and the current row number)
 = The truthy indices are as expected
 * Perform logical "and" with the accumulator
 Implicit output of the final accumulator

#Stax, 15 bytes CP437

Çoφ╕é┘`2x|◙╘▓╠█

Try it online!

Unpacked version with 17 bytes:

Z+{|e}({Bsr+m:fDm

Longer than I expected ...

Explanation

Z+{|e}({Bsr+m:fDm P
Z+ Prepends the array with a zero
 {|e}( Separate array into parts
 Each part starts with an even number, followed by a run of odd numbers
 { m For each part
 Bsr+ Reverse the odd run and keep the heading even number intact
 :fD Flatten the nested array and remove the heading zero
 m Print the array, one element per line.
 
Source Link
Weijun Zhou
  • 3.7k
  • 15
  • 42
Loading

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