Count the number of functions from A numbered switches onto B numbered bulbs, modulo 1000000007, i.e. B! times Stirling number of the second kind S(A, B).
Medium6CombinatoricsDynamic programmingMathNumber theoryNo attempts yetTime limit1sMemory limit64 MB