Search
⌘K

Leetcode 2549. Count Distinct Numbers on Board

Starting from n, repeatedly add any i in [1,n] for which some current board value x satisfies x % i == 1, and after many iterations return the number of distinct integers present. Equivalently, compute the size of the reachability/closure set in a directed graph with edges x → i whenever x % i == 1 (n ≤ 100).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.