Skip to main content
1 of 3
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68

Python, 95 bytes

This is a Python implementation of nimi's Haskell answer. Golfing suggestions welcome.

f=lambda z:z and(z[0]+len(z)-1)*f([i-1for i in z if~-i])or 1
p=lambda z:z and f(z)*p(z[1:])or 1
Sherlock9
  • 12.3k
  • 1
  • 30
  • 68