There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut these doors in a particular manner:
Given n doors, return the list of open doors.
Example:
Let's say n = 3.
So:
Input n = 3 Output y is 1
The description does not match the example: The point 3 should be "3. On the # trip down the alley, start with door # [and process every #-th door]".
I agree with Jan - the description is not clear. The final instruction should be "return the list of open door #'s", presumably.
If the description was clearer, I'd give this problem a "like", because a good solution depends on a good analysis of the problem more than on just neat coding.
Sorry about the confusion. I tried to clarify the problem description.
Nice problem! The explicit solution was very surprising to me once I found it.
Classic problem--unfortunate that the test suite reveals the punchline.
Yes I initially thought y = sum(open doors)
good problem, easy solution once realising how to solve
easy if to think a bit
though I did not understand the question...
Very nice solution without for loop
Problem isn't robust to direction of vector
Genius!
Nice explanation. I just derivated the formula from the solution ;-)
1528 Solvers
Which values occur exactly three times?
3306 Solvers
616 Solvers
1878 Solvers
Who knows the last digit of pi?
488 Solvers