Skip to content

Commit 9bdfd7e

Browse files
authored
Add largestOverlap function for image comparison
Implement function to calculate largest overlap between two images.
1 parent 823618d commit 9bdfd7e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @param {number[][]} img1
3+
* @param {number[][]} img2
4+
* @return {number}
5+
*/
6+
var largestOverlap = function(img1, img2) {
7+
let count = 0;
8+
let max = 0;
9+
10+
for (let i = 0; i<img1.length; i++){
11+
for (let j = 0; j<img1.length; j++){
12+
if (img1[i][j] == 1) {
13+
14+
}
15+
}
16+
}
17+
18+
max = Math.max(max, count);
19+
};

0 commit comments

Comments
 (0)