← Pointer Manipulation

Micro-Drill #21 — Find length

Pointer Manipulation Target: 10s

Length calculation requires full traversal. Used as a helper in remove-nth-from-end.

length = 0
while cur:
    length += 1
    cur = cur.next

Type it from memory. Go.

Practice Problems

Related Coding Drills

← Micro #20 Micro #22 →