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

Function getWindows

javascript/0042-trapping-rain-water.js:86–94  ·  view source on GitHub ↗
(height, left, maxLeft, right, maxRight)

Source from the content-addressed store, hash-verified

84const getHeights = (height, left, right) => [height[left], height[right]];
85
86const getWindows = (height, left, maxLeft, right, maxRight) => {
87 const [leftHeight, rightHeight] = getHeights(height, left, right);
88 const [leftWindow, rightWindow] = [
89 maxLeft - leftHeight,
90 maxRight - rightHeight,
91 ];
92
93 return [leftWindow, rightWindow];
94};

Callers 1

trapFunction · 0.85

Calls 1

getHeightsFunction · 0.85

Tested by

no test coverage detected