We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
While I agree this works, not sure if this is what was intended from the prompt. In the last section it describes: "Once we hit n=10, we print the first ten terms as a single line of space-separated integers.", which would imply that they want you to do the entire series calculation first, then print the result.
Seems a bit weird that this is where it is in the challenge list, as I would think a recursive solution is called for in that case.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops II
You are viewing a single comment's thread. Return to all comments →
While I agree this works, not sure if this is what was intended from the prompt. In the last section it describes: "Once we hit n=10, we print the first ten terms as a single line of space-separated integers.", which would imply that they want you to do the entire series calculation first, then print the result.
Seems a bit weird that this is where it is in the challenge list, as I would think a recursive solution is called for in that case.