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

ความคิดเห็น • 3

  • @anisha_joshi15
    @anisha_joshi15  หลายเดือนก่อน

    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

    • @nitby27
      @nitby27 หลายเดือนก่อน

      its not working

    • @anisha_joshi15
      @anisha_joshi15  หลายเดือนก่อน

      @@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 !