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: Construct a binary tree from preorder and inorder traversals.

Given the preorder and inorder traversals (both as std::span<int>), construct the corresponding binary tree.

Use the add_node(int) method on the provided tree object and return the root node.

Solve it yourself: compiler-explorer.com/z/Y4WoE3
Solution: compiler-explorer.com/z/zdcfjs