hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.4K
active users

Šimon Tóth

Tuesday common C++ interview problem: Number of reorders of a serialized BST.

Given a permutation of 1..N as std::vector<int>, return the number of other permutations that produce the same BST. The BST is produced by inserting elements in the order of their indexes (i.e. left-to-right).

Return the result as modulo 10^9+7.

Solve it yourself: compiler-explorer.com/z/aPjrno
Solution: compiler-explorer.com/z/shvje5