Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def croce(A,i,j):
- #@param A: matrix of numbers
- #@param i : int
- #@param j: int
- #@return bool
- h = len(A) #altezza matrice
- w = len(A[0]) #larghezza matrice
- check = 0
- if (i-1 < 0) or (A[i][j]>A[i-1][j]):
- check+=1
- if (i+1>=h) or (A[i][j]>A[i+1][j]):
- check+=1
- if (j-1<0) or (A[i][j]>A[i][j-1]):
- check+=1
- if (j+1>=w) or (A[i][j]>A[i][j+1]):
- check+=1
- if check == 4:
- return True
- else:
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement