algorithm notes: leetcode#531 lonely pixel 1

Problem


Analysis


Solution


1
2
3
4
5
6
7
class :
def findLonelyPixel(self, picture):
"""
:type picture: List[List[str]]
:rtype: int
"""
return sum([1==col.count('B')==picture[col.index('B')].count('B') for col in zip(*picture)])

531. Lonely Pixel I