medium10 pts · first answer countsstacks-and-queues
Middle node of an even-length list
Both pointers start at head. The loop is while (fast && fast.next) { slow = slow.next; fast = fast.next.next }. For the list 1 to 6, which node is slow at the end?
Discussion 0
Join free to post in the discussion.
Related questions
- Order rule of a stackBackend Developer
- Order rule of a queueBackend Developer
- Trace stack push and popBackend Developer
- Trace queue operationsBackend Developer
- Using a JavaScript array as a stackBackend Developer
- Cost of Array.shift in a queueBackend Developer
- Cause of a stack overflow errorBackend Developer
- Serving patients by severityBackend Developer