Search
⌘K
Get Premium
Leetcode 3529. Count Cells in Overlapping Horizontal and Vertical Substrings
Count how many cells belong to at least one horizontal substring (left-to-right, wrapping from end of a row to the first column of the next row) and at least one vertical substring (top-to-bottom, wrapping from bottom of a column to the first row of the next column) that both equal the given pattern. The challenge is to efficiently find and intersect all matching horizontal and vertical occurrences in an m×n grid (m·n ≤ 1e5) under the specified wrap rules.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.