Well, although this challenge turned out to be a huge success, it also turned out to be very trivial to solve. Therefore, for those of looking for more of a challenge, I created a sequel to this challenge in which you must now count the number of unique rectangles. Check it out!
Now, for those of you looking to solve this challenge, here it comes.
Well, we don't really have a challenge like this yet, so here we go.
3 x 3 grid of rectangles:
How many rectangles are there? Well, counting visually, we can see that there are actually
36 rectangles, including the entire plane itself, which are all shown in the animated GIF below:
The counting of rectangles as shown above is the task. In other words, given 2 integers greater than or equal to
m represents the width and
n represents the height, output the total number of rectangles in that
m x n grid of rectangles.
The use of any built-ins that directly solve this problem is explicitly disallowed.
This challenge is not about finding the shortest answer, but finding the shortest answer in every language. Therefore, no answer will be accepted.
Standard loopholes are prohibited.
Presented in the format
Array of Integers Input -> Integer Output:
[0,0] -> 0 [1,1] -> 1 [3,3] -> 36 (Visualized above) [4,4] -> 100 [6,7] -> 588
Remember, this is code-golf, so shortest code wins!
588for the last test-case. \$\endgroup\$