C++ (Coding)
Test your proficiency with our C++ Coding Challenge Assessment, a comprehensive test focused on your ability to solve algorithms across various C++ topics.
Highlights:
Broad Spectrum: Challenges cover all C++ topics, requiring a solid grasp of the entire language from basic structures to advanced functionalities.
Algorithmic Solutions: Emphasis on solving diverse algorithms, demonstrating your depth in data structure manipulation, and optimized coding.
Efficiency Required: The assessment values not only correctness but also code efficiency, pushing for best practices in optimized programming.
This direct and focused assessment is designed to test your C++ knowledge in a real-world scenario, marking your skill level in both problem-solving and efficient code formulation.
Start TodayCoding
Your favorite shop sells n Kinder Surprise chocolate eggs. You know that exactly s stickers and exactly t toys are placed in n eggs in total.
Each Kinder Surprise can be one of three types:
- it can contain a single sticker and no toy;
- it can contain a single toy and no sticker;
- it can contain both a single sticker and a single toy.
But you don't know which type a particular Kinder Surprise has. All eggs look identical and indistinguishable from each other.
What is the minimum number of Kinder Surprise Eggs you have to buy to be sure that, whichever type they are, you'll obtain at least one sticker and at least one toy?
Note that you do not open the eggs in the purchasing process; that is, you buy some number of eggs. It's guaranteed that the answer always exists.
Example:
n = 10
s = 5
t = 7
We have to take at least 6 eggs because there are 5 eggs with only one toy inside, and in the worst case, we'll buy all of them.