Praveen Pandit
BAN USERclass lonelyPixel:
def __init__(self):
self.matrix = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
]
self.row = len(self.matrix[0])
self.col = len(self.matrix)
def isNotSameRow(self, row, col, rng):
if rng < 0:
return True
if col != rng and self.matrix[row][col] == self.matrix[row][rng]:
return False
return self.isNotSameRow(row, col, rng - 1)
def isNotSameCol(self, row, col, rng):
if rng < 0:
return True
if row != rng and self.matrix[row][col] == self.matrix[rng][col]:
return False
return self.isNotSameCol(row, col, rng - 1)
def find(self):
for i in range(self.col):
for j in range(self.row):
if self.isNotSameRow(i, j, self.row-1) and self.isNotSameCol(i, j, self.col-1):
print(i, j)
if __name__ == '__main__':
lonely = lonelyPixel()
lonely.find()
- Praveen Pandit May 30, 2019