Skip to main content
3 of 4
added 498 characters in body
Justin Mariner
  • 5k
  • 1
  • 13
  • 18

Japt, 8 bytes

ò¦ ®ì2Ãx

Try it online!

Explanation

Implicit input: [1, 1, 1, -1, -1, -1, -1, 1, 1]

ò¦

Partition input array (ò) between different (¦) elements:
[[1, 1, 1], [-1, -1, -1, -1], [1, 1]]

®ì2

Map each partition (®) to itself parsed as an array of base-2 digits (ì): [7, -15, 3]

Ãx

End mapping (Ã) and sum (x): -5

Justin Mariner
  • 5k
  • 1
  • 13
  • 18