0
C# Code Project 33: Solved the challenge but not using recursion
static int Points(int levels) { var points = 0; for(int i = 1; i < levels + 1; i++) points += i; return points; } The instructions specify to "recursively calculate" but why when the above is simpler?
2 odpowiedzi
+ 1
Sololearn only checks whether your code produces the expected output for the given input. It does not check how that output is achieved. Because of that sololearn accepts solutions that don't follow the instructions as long as they produce the expected output.
+ 1
The challenge specifically instructed us to do this using recursion because the goal of the challenge task is to encourage us to practice on the subject (recursion), in a hope that we understand it afterwards.