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.
I think the designer of the problem, should answer this observation. Please do not say to solve it with below solution, since we all know this solution works. However, this solution, was not described the way the original question is described.
Thanks
sum_arr = []
for row in range(n):
for col in range(n):
max_of = max([matrix[row][col],matrix[row][2*n-1-col],matrix[2*n-1-row][col],matrix[2*n-1-row][2*n-1-col]])
print("Comparing max among these elements:")
print([matrix[row][col],matrix[row][2*n-1-col],matrix[2*n-1-row][col],matrix[2*n-1-row][2*n-1-col]])
sum_arr.append(max_of)
print(row, col, max_of, sum_arr)
return sum(sum_arr)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping the Matrix
You are viewing a single comment's thread. Return to all comments →
I think the designer of the problem, should answer this observation. Please do not say to solve it with below solution, since we all know this solution works. However, this solution, was not described the way the original question is described.
Thanks
sum_arr = []