Array
3718. Smallest Missing Multiple of K
Drop nums into a hash set, then walk the multiples k, 2k, 3k, ... and return the first one the set doesn't hold. The membership test is what makes this cheap: I never need to know which multiples are present, only where the first hole is.
Loading…