In this Leetcode problem, we are implementing a Queue from from with we can push and pop from the front, back, or middle.
Obviously, the pop and push from the middle are the core of the problem. Otherwise we could use a LinkedList.
To solve this problem, we break up the linked list into 2 linked lists. We split it in the…