#Last 3 numbers

1 messages · Page 1 of 1 (latest)

signal gazelle
#

I am having a hard time understanding how to do this question. I know that I'm supposed to store the last 3 numbers in an array and I know how array works but I just don't understand how I'm supposed to store the last 3 numbers into the array since the user can input as many numbers as they want. How should I make the program store any last 3 numbers that the user enters? For example, if the user enters like 20 numbers or something, how should I make the program store the last 3 numbers of that sequence? or what if the user were to enter 10 numbers instead? Any help would be appreciated1

pine yarrowBOT
#

<@&987246399047479336> please have a look, thanks.

violet fern
#

It's in the hint, you just track the last 3 and shift them.

ripe jetty
#

You can use arraylist or stack for it. It’s not the optimised method but it’ll get the job done

signal gazelle
#

We are only allowed to use arrays

signal gazelle
#

I'll try it out

violet fern
#

And given it looks like an assignment, you shouldn't "cheat" by using an "easier" data type.

ripe jetty