766. Toeplitz Matrix | Leetcode Hindi | Java
Vložit
- čas přidán 30. 10. 2022
- Hi folks! Comeback kar rhe h break ke baad let's go.
Here we are solving766. Toeplitz Matrix
|| LeetcodeJava || O(M*N) time complexity || O(1) Space complexity
Easy explanation in Hindi.
Problem link: leetcode.com/problems/toeplit...
If you have any queries reach out to me at
linktr.ee/udyanojha
Bhai, mai ekdum yahi so raha tha par aapne kitni asaani se bta diya. Well done 👍
Awesome h ye toh Aman bhai… lessgo 🔥
happy to see you again
Thank you so much bhai!
continue karo bhai series ab se 😃
Anish bhai! Connect me on Linkedin thoda time aur lagega regular aane me. Thank you so much for being here always.
Hi! Anish. Started making videos, and kuch naya aane wala h.
Mene bhi DSA band kr dia Tha Apne video dalni band ki thi tabse bhai. Ab wapis continue kr raha hu.
Help a lot
Means a lot thank you for being here
Your approach is good but initially got below approach in my mind and implemented but after watching your solution it good
class Solution {
public static boolean checkToeplitz(int i, int j,int[][] matrix){
while(i < matrix.length && j < matrix[0].length){
if(matrix[i][j] != matrix[i-1][j-1]){
return false;
}
i++;
j++;
}
return true;
}
public boolean isToeplitzMatrix(int[][] matrix) {
int n = matrix.length;
int m = matrix[0].length;
//My approach is first check the first row whether it is diagonally perfect then check first column whether it is diagonally perfect.
//row checking
int currentRow = 0;
for(int i=0;i
this code is not working bro 😢😢
Sad. Let me look into it
add the additional condition in "if" block as i>=0 and j>=0