Skip to main content
3 of 3
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/

Python, 95 91 bytes

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

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