โ† Walmart questions

Rectangle sum in 2D matrix

Filed under Walmart

Given a 2D matrix, calculate the sum of all elements within a rectangle defined by top-left (r1, c1) and bottom-right (r2, c2) coordinates.

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 Walmart questions

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