Search
⌘K

Leetcode 1878. Get Biggest Three Rhombus Sums in a Grid

Find every distinct sum of the border cells of all 45°-rotated square (rhombus) shapes that fit in an m×n grid (including size-0 single-cell rhombi) and return the largest three distinct sums in descending order. Efficient solutions iterate possible centers and sizes while using diagonal traversal or diagonal prefix sums to compute each rhombus border sum quickly (m,n ≤ 50).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.