Instead of pushing values in a large array, everything is stored in a 2-dimensional one:
whoIsNext(["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"], 7230702951)
"Leonard"
// "queue" will store the following value in the end:
[["Sheldon", 1073741824],
["Leonard", 1073741824],
["Penny", 536870912],
["Rajesh", 536870912],
["Howard", 536870912]]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Had to do a few tweaks to allow large numbers to be used as index:
Instead of pushing values in a large array, everything is stored in a 2-dimensional one: