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

#MATL , 6 bytes

MATL , 6 bytes

toYs~)

Try it online!

###Explanation

Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Cumulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display

#MATL , 6 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Cumulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display

MATL , 6 bytes

toYs~)

Try it online!

Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Cumulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display
edited body
Source Link
a spaghetto
  • 11.3k
  • 3
  • 48
  • 83

#MATL, 6 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % ComulativeCumulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display

#MATL, 6 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Comulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display

#MATL, 6 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Cumulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display
added 37 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

#MATL, 56 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Comulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index to take element frominto the original array. Implicitly display

#MATL, 5 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry
Ys % Comulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index to take element from the array. Implicitly display

#MATL, 6 bytes

toYs~)

Try it online!

###Explanation

t % Input array implicitly. Duplicate
o % Parity of each entry. Gives 0 for even entries, 1 for odd
Ys % Comulative sum
~ % Logical negate. Gives true for the first run of even entries, and then false
) % Use this as logical index into the original array. Implicitly display
Post Undeleted by Luis Mendo
Post Deleted by Luis Mendo
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading

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