MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / subtractLeftFrequency

Function subtractLeftFrequency

javascript/0076-minimum-window-substring.js:64–75  ·  view source on GitHub ↗
(s, left, frequencyMap, matched)

Source from the content-addressed store, hash-verified

62};
63
64const subtractLeftFrequency = (s, left, frequencyMap, matched) => {
65 const char = s[left];
66
67 if (frequencyMap.has(char)) {
68 const isOutOfWindow = frequencyMap.get(char) === 0;
69 if (isOutOfWindow) matched--;
70
71 frequencyMap.set(char, frequencyMap.get(char) + 1);
72 }
73
74 return matched;
75};
76
77const getSubString = (s, start, end) =>
78 end <= s.length ? s.slice(start, start + end) : '';

Callers 1

getWindowPointersFunction · 0.70

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected