Free written solution

Image Overlap (LeetCode 835): Solution and Explanation

Slide one binary n x n image over another (no rotation, cells past the edge are lost) and return the largest number of positions where both images hold a 1.

Read the intuition, approach, code and complexity →