Solutions
Now, let’s delve into the solutions for these exercises. As always, these solutions represent one of the ways in which the problem can be solved. They are provided just to help you verify your work and to offer insights into different ways of approaching recursive problems.
Exercise 1
int CountAllEnemies(Wave wave) { int count = 0; foreach (var content in wave.Contents) { switch (content) { case Enemy: ...