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's common C++ interview problem: Candy for greedy children.

Given a line of children with different levels of greediness, determine the minimum number of candies you need to use to satisfy every child.

Each child must receive at least one candy, and each child must receive more candy than their less greedy neighbours.

Solve it yourself: compiler-explorer.com/z/cc5369
Solution: compiler-explorer.com/z/bcYG95