Amazon interview question

Converting from linked list to int