Open Ritabrata95 opened 8 months ago
https://github.com/careercup/CtCI-6th-Edition/blob/59018cfcb90292209275db1c4b3ed306d4b07d7f/Java/Ch%2003.%20Stacks%20and%20Queues/Q3_01_Three_in_One/FixedMultiStack.java#L28
I think the correct code would be "values[indexOfTop(stackNum) + 1] = value;" because the existing code is overriding the top element instead of adding a new element in the top of the stack.
https://github.com/careercup/CtCI-6th-Edition/blob/59018cfcb90292209275db1c4b3ed306d4b07d7f/Java/Ch%2003.%20Stacks%20and%20Queues/Q3_01_Three_in_One/FixedMultiStack.java#L28
I think the correct code would be "values[indexOfTop(stackNum) + 1] = value;" because the existing code is overriding the top element instead of adding a new element in the top of the stack.