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

Function canBreak

javascript/0139-word-break.js:16–21  ·  view source on GitHub ↗
(s, wordSet, start = 0)

Source from the content-addressed store, hash-verified

14};
15
16var canBreak = (s, wordSet, start = 0) => {
17 const isBaseCase = start === s.length;
18 if (isBaseCase) return true;
19
20 return dfs(s, wordSet, start); /* Time O(2^N) | Space O(N) */
21};
22
23var dfs = (s, wordSet, start) => {
24 for (let end = start + 1; end <= s.length; end++) {

Callers 3

wordBreakFunction · 0.85
dfsFunction · 0.85
canWordBreakFunction · 0.85

Calls 2

checkWordFunction · 0.85
dfsFunction · 0.70

Tested by

no test coverage detected