Get At In Doubly Linkedlist
1. You are given a partially written DoublyLinkedList class.Input Format
2. You are required to complete the body of getAt function. This function is supposed to return value of node at given index.
3. If size of list is zero then return "ListIsEmpty: -1".
4. If Inddex is Invalid then return "IndexIsInValid: -1".
5. You are required to update head, tail and size as required.
6. Input and Output is managed for you. Just update the code in incomplete 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 in managed for you.Output Format
output in managed for you.Question Video
0 <= N <= 10^6Sample Input
addFirst 10Sample Output
addFirst 20
addFirst 30
addLast 40
addLast 50
removeLast
removeFirst
addFirst 90
getAt 2
stop
50
30
10
[90, 20, 10, 40]
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run