Created
December 6, 2014 17:57
-
-
Save sunloverz/05cb8d2970d2a71e7929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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