Skip to main content
4 of 4
edited body
Makonede
  • 6.6k
  • 20
  • 49

Jelly, 8 bytes

,CÄḤ×ƊS_

Try it online!

-2 bytes thanks to Bubbler

How it works

,CÄḤ×ƊS_ - Main link. Takes a binary list B on the left
 C       - Complement. Flip the bits of B
,        - Pair with B: [B, B']
     Ɗ   - Last 3 links as a monad f([B, B']):
  Ä      -   Cumulative sum of each
   Ḥ     -   Unhalve
    ×    -   Multiply modified B by B and modified B' by B'
      S  - Columnwise sum
       _ - Subtract B, elementwise