Sollicitatievraag bij Meta

Recursively reverse a LL

Antwoord op sollicitatievraag

Anoniem

25 nov 2010

function reverse($node) { if (!$node->next) { return $node; } $lastNode = reverse($node->next); $node->next->next = $node; $node->next = null; return $lastNode; }

4