Skyera interview question

Was asked to optimizing a solution on a linked list solution