“This solution is the best of the three solutions in this lesson, as the transfer of elements between stacks takes place only if tempStack
is empty. Therefore, the amortized complexity of the dequeue operation becomes O(1) while the time complexity for the enqueue operation is O(n).”
I think this is inverted: dequeue takes O(n) and enqueue takes O(1)