Capital One interview question

Coding Round in arrays and linked list