JavaScript Big Combination Problem
hk7math
Posted on January 15, 2020
A recent CodeSignal Challenge was to calculate 1000C500 (mod 1e9+7) and I got defeated =(
All my trials exceeded the time limit.. Here is the best JS solution by psr
, could anyone explain what happens in this line??? I learnt ES6 but got no idea about this syntax...
f[o = n + 1/k] = o in f
full solution for reference, please tell me to delete this if I violated any rule...
f = countWays = (n, k) => f[o = n + 1/k] = o in f
? f[o]
: k
? n && (f(--n, k) + f(n, k - 1)) % (1e9 + 7)
: 1
💖 💪 🙅 🚩
hk7math
Posted on January 15, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.