Skip to content

Bug Report for range-sum-query-2d-immutable #5366

@PrakashArumugam1

Description

@PrakashArumugam1

Bug Report for https://neetcode.io/problems/range-sum-query-2d-immutable

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

Explanation in the question - captures the color of the rectangle but it is not visible in the actual question - pasted the explanation below and screen shot for reference

Explanation:
NumMatrix numMatrix = new NumMatrix([[3, 0, 1, 4, 2], [5, 6, 3, 2, 1], [1, 2, 0, 1, 5], [4, 1, 0, 1, 7], [1, 0, 3, 0, 5]]);
numMatrix.sumRegion(2, 1, 4, 3); // return 8 (i.e sum of the red rectangle)
numMatrix.sumRegion(1, 1, 2, 2); // return 11 (i.e sum of the green rectangle)
numMatrix.sumRegion(1, 2, 2, 4); // return 12 (i.e sum of the blue rectangle)

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions