logo CodeStepByStep logo

memoryNumberGame2

Write a method named memoryNumberGame2 (similar to the previous exercise, memoryNumberGame). The only difference between this exercise and the previous one is that we will pass very large values for the number of iterations in the sequence. Specifically, your code must be efficient enough to compute the 30000000th value in the sequence quickly.

(This exercise is based on the Advent of Code 2020, day 15.)

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.