MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Function dfs

javascript/0206-reverse-linked-list.js:14–21  ·  view source on GitHub ↗
(curr)

Source from the content-addressed store, hash-verified

12};
13
14const dfs = (curr) => {
15 const prev = reverseList(curr.next); /* Time O(N) | Space O(N) */
16
17 curr.next.next = curr;
18 curr.next = null;
19
20 return prev;
21};
22
23/**
24 * https://leetcode.com/problems/reverse-linked-list/

Callers 1

reverseListFunction · 0.70

Calls 1

reverseListFunction · 0.70

Tested by

no test coverage detected