Toeplitz matrix || GFG POTD || 27th june || easy approach
ฝัง
- เผยแพร่เมื่อ 25 มิ.ย. 2024
- time complexity : O(min(n,m)) [the loop will run till size of min of (m,n)]
space complexity : O(1) [ no extra data structure is used]
check comments for code 😀
#gfg #dailychallenge #gfgpotd #coding #geeksforgeeks #easy
bool isToepliz(vector& mat) {
// code here
int n=mat.size();// row size
int m=mat[0].size();//column size
if(n==1||m==1){ //if anyone is 1
return true;
}
int idx;
idx =min(m,n); //storing the min from row or columns size
int a;
a=mat[0][0];//storing the first element of diagonal
int i=1;
//i=1, idx=3
while(i
its not working
@@nitby27 as you can see when I submitted the solution it ran properly I guess they must have introduced some changes in the question , it's common in gfg... I will provide the updated solution !