FunctionRacerProblemsRace

Rectangles in a Grid

EasyMathPython, JavaScript, TypeScript, Java, C++

A grid has rows by cols unit squares. Return the total number of rectangles of any size that can be drawn along the grid lines (squares count as rectangles).

Example 1

rows 2
cols 2
returns 9

4 small squares, 4 dominoes, 1 big square: 9.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems