ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
could you please explain how to do the follow up questions?
Did you get the answer to this?
I tried this:class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: for row in range(len(matrix)-1): for col in range(len(matrix[0])-1): if matrix[row][col] != matrix[row+1][col+1]: return False return True
Great insight! Simple and readable..
God bless you ❤️🙏
The solution tab shows a much more concise solution where we just iterate thru the entire grid all at once (4 lines of code).
Noticed also. However, this uses a highly generalizable pattern in case you don't quickly see that "trick" (repeatedly traversing a section of a data structure.)
thank you sir
I appreciate you :)
nice
No problem, thanks for watching
could you please explain how to do the follow up questions?
Did you get the answer to this?
I tried this:
class Solution:
def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:
for row in range(len(matrix)-1):
for col in range(len(matrix[0])-1):
if matrix[row][col] != matrix[row+1][col+1]:
return False
return True
Great insight! Simple and readable..
God bless you ❤️🙏
The solution tab shows a much more concise solution where we just iterate thru the entire grid all at once (4 lines of code).
Noticed also. However, this uses a highly generalizable pattern in case you don't quickly see that "trick" (repeatedly traversing a section of a data structure.)
thank you sir
I appreciate you :)
nice
No problem, thanks for watching