Javascript: Seeking help on explanation for a big combination algorithm

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 = nCk = (n, k) => f[o = n + 1/k] = o in f
    ? f[o]
    : k 
        ? n && (f(--n, k) + f(n, k - 1)) % (1e9 + 7)
        : 1

Leave a Reply

Your email address will not be published. Required fields are marked *