Ad
  • Custom User Avatar

    The test numbers are smaller than the max of a signed 32bit integer. However, with each rotation through the queue you take a name out and then put it back on twice. As such the queue is growing exponentially in size and eventually the compiler is throwing an error when the queue is too large to fit any more entries in it.

    I'm only commenting as my original solution was similar to yours and I hit the same problem!

  • Custom User Avatar

    In modern day systems are 64 bit, because 32 bit becomes too small at some point (just like this case). I do agree that I should've used 64 bit queue, but still the number 159222638 and 121580142 are smaller than the max value for a signed 32 bit Integer.

  • Custom User Avatar

    It's not because the tests stop after some time... I think it's because the Queue is growing expodentially in size and exceeds the Int32 limit.