Skip to content

Instantly share code, notes, and snippets.

@k4zy
Created December 6, 2013 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k4zy/7820711 to your computer and use it in GitHub Desktop.
Save k4zy/7820711 to your computer and use it in GitHub Desktop.
import math
import string
class RectangularGrid:
def countRectangles(self, width, height):
counter = 0
for i in range(1,width+1):
for j in range(1,height+1):
if i != j:
counter += ( (1+ (width-i)) * (( 1 + (height- j))) )
return counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment