← Amazon questions

Submatrix sum query

Filed under Amazon

Given a 2D matrix of integers, implement a data structure or preprocessing method to answer submatrix sum queries in O(1) time, where each query is defined by the coordinates of the top-left (r1, c1)…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.