Search
⌘K
Get Premium
Leetcode 3128. Right Triangles
Count the number of axis-aligned right triangles formed by three 1s in a binary grid, where one vertex shares a row with a second 1 and a column with a third (i.e., the right angle is at their intersection). With grid sizes up to 1000×1000, the task is to aggregate contributions of each 1 based on counts of 1s in its row and column to achieve an O(n·m) solution.
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.