Maximum Sum of a Diamond in a Matrix

Given an m × n integer matrix grid, define a diamond centered at (r, c) with radius k as all cells satisfying:

|i - r| + |j - c| <= k

The diamond must be fully contained in the m...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: