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

Function addRightFrequency

javascript/0567-permutation-in-string.js:47–54  ·  view source on GitHub ↗
(s, right, frequencyMap)

Source from the content-addressed store, hash-verified

45const getCode = (char) => char.charCodeAt(0) - 'a'.charCodeAt(0);
46
47const addRightFrequency = (s, right, frequencyMap) => {
48 const char = s[right];
49 const index = getCode(char);
50
51 frequencyMap[index]++;
52
53 return frequencyMap[index];
54};
55
56const subtractLeftFrequency = (s, left, frequencyMap) => {
57 const char = s[left];

Callers 1

checkInclusionFunction · 0.70

Calls 1

getCodeFunction · 0.70

Tested by

no test coverage detected