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.5K
active users

Šimon Tóth

Tuesday common C++ interview problem: Minimize deviation in an array

Given an array of unsigned integers, determine the minimum deviation (max-min) achievable by repeatedly applying the following operations:

- divide an even element by two
- multiply an odd element by two

Solve it yourself: compiler-explorer.com/z/n6654c
Solution: compiler-explorer.com/z/34hevr