← Linked List Quiz: all 8 questions
Linked List Quiz · Question 8 of 8
Which steps solve "Palindrome Linked List" in O(1) extra space? (select all that apply)
Which steps solve "Palindrome Linked List" in O(1) extra space? (select all that apply)
- A.Find the middle with fast & slow pointers
- B.Reverse the second half
- C.Compare the two halves node by node
- D.Copy all values into an array and reverse it
Answer & explanation
Correct answer: Find the middle with fast & slow pointers · Reverse the second half · Compare the two halves node by node
Copying into an array works but uses O(n) space; the three pointer steps need only O(1).
Can you get the rest right without peeking?
Take the timed Linked List Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →