Skip to content

Instantly share code, notes, and snippets.

@sunloverz
Created December 6, 2014 17:57
Show Gist options
  • Select an option

  • Save sunloverz/05cb8d2970d2a71e7929 to your computer and use it in GitHub Desktop.

Select an option

Save sunloverz/05cb8d2970d2a71e7929 to your computer and use it in GitHub Desktop.
class GardenHose:
def countDead(self, n, rowDist, colDist, hoseDist):
count = 0
for row in range(0, n):
for col in range(0, n):
if (row + 1) * rowDist <= hoseDist or (n - row) * rowDist <= hoseDist:
continue
if (col + 1) * colDist <= hoseDist or (n - col) * colDist <= hoseDist:
continue
count += 1
return count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment