Skip to main content
added 307 characters in body
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 10 bytes

ωoṁS↑o%2Lg

Try it online! Explanation to come later.

Explanation

ωoṁS↑o%2Lg
ω           Repeat until fixed point
 o          the following two functions:
         g   a) group adjacent elements
  ṁ          b) map over groups and concatenate:
        L     length of group
     o%2      mod 2
   S↑         take that many elements of group

Husk, 10 bytes

ωoṁS↑o%2Lg

Try it online! Explanation to come later.

Husk, 10 bytes

ωoṁS↑o%2Lg

Try it online!

Explanation

ωoṁS↑o%2Lg
ω           Repeat until fixed point
 o          the following two functions:
         g   a) group adjacent elements
  ṁ          b) map over groups and concatenate:
        L     length of group
     o%2      mod 2
   S↑         take that many elements of group
Source Link
Zgarb
  • 42.8k
  • 4
  • 79
  • 259

Husk, 10 bytes

ωoṁS↑o%2Lg

Try it online! Explanation to come later.