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

Function traversePath

javascript/0071-simplify-path.js:16–20  ·  view source on GitHub ↗
(path, stack)

Source from the content-addressed store, hash-verified

14};
15
16const traversePath = (path, stack) => {
17 if (canPush(path)) return stack.push(path);
18
19 if (canPop(path, stack)) stack.pop();
20};
21
22const canPush = (path) =>
23 !(isCurrentDirectory(path) || isParentDirectory(path));

Callers 1

simplifyPathFunction · 0.85

Calls 4

canPushFunction · 0.85
canPopFunction · 0.85
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected