Add Last In Doubly Linkedlist

easy
1. You are given a partially written DoublyLinkedList class.
2. You are required to complete the body of addLast function. This function is supposed to add an element to the front of LinkedList. You are required to update head, tail and size as required.
3. Input and Output is managed for you. Just update the code in addLast function.

Note -> Use the code snippet and follow the algorithm discussed in question video. The judge can't 
        force you but the intention is to teach a concept. Play in spirit of the question.

Input Format

input in managed for you.

Output Format

output in managed for you.

Constraints

0 <= N <= 10^6

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
addFirst 4
addFirst 4
addLast 5
addFirst 7
addLast 1
stop
Output
[7, 4, 4, 5, 1]
Previous
Add First In Doubly Linkedlist
Next
Remove First In Doubly Linkedlist

Related Questions