Moderator: Board moderators
pvncad wrote:use cycle detection algorithm

Abednego wrote :
Or you could just remember all of the numbers you've seen so far and stop as soon as you reach a previously seen number. That's what I did.
set<int> seen;
finally .. AC
Users browsing this forum: No registered users and 0 guests