You are viewing a single comment's thread. Return to all comments →
Python 3|Simple|Easy to Understand
import functools def beadOrnaments(b): ans = functools.reduce(lambda ans, a: ans * (a ** (a - 1)), b,1) sm = functools.reduce(lambda sm, a: sm + a, b,0) if (len(b) - 2 >= 0): ans *= sm ** (len(b) - 2) else: ans //= sm return ans % 1000000007
Seems like cookies are disabled on this browser, please enable them to open this website
Bead Ornaments
You are viewing a single comment's thread. Return to all comments →
Python 3|Simple|Easy to Understand