We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
pl = []
result = 0
for i,j in product(range(len(grid)), range(len(grid[0]))):
if grid[i][j] == 'G':
pl2 = set()
for k in range(0, len(grid)//2+1):
if j-k<0 or j+k>len(grid[0])-1 or i-k<0 or i+k>len(grid)-1:
break
if grid[i][j-k] == grid[i][j+k] == grid[i-k][j] == grid[i+k][j] == 'G':
pl2.update(((i,j-k),(i,j+k,),(i-k,j),(i+k,j)))
pl.append(pl2.copy())
else:
break
for i in combinations(pl, 2):
if not i[0] & i[1]:
result = max(result, len(i[0])*len(i[1]))
return result
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Ema's Supercomputer
You are viewing a single comment's thread. Return to all comments →
def twoPluses(grid):