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

Method add

javascript/2013-detect-squares.js:11–18  ·  view source on GitHub ↗
(point, { map, points } = this)

Source from the content-addressed store, hash-verified

9 }
10
11 add (point, { map, points } = this) {
12 const [ x, y ] = point;
13 const key = this.getKey(x, y);
14 const value = ((map[key] || 0) + 1);
15
16 map[key] = value; /* Space O(N) */
17 points.push(point);/* Space O(N) */
18 }
19
20 count (point, { points } = this, score = 0) {
21 const [ x1, y1 ] = point;

Callers

nothing calls this directly

Calls 2

getKeyMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected