Rectangles in a Grid
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
1 <= rows, cols <= 50
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.