Coverage of all Zeros in a Binary Matrix | gfg potd | 26-06-24 | GFG Problem of the day

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • Geeks for Geeks Problem of the Day(POTD) in C++ | Coverage of all Zeros in a Binary Matrix | Fully Explained🧠
    Solution Code :
    github.com/Ish...
    IMPORTANCE OF DSA FOR PLACEMENT:
    • Is DSA Still Important...
    BEST FREE WEB DEVELOPMENT COURSE:
    • Video
    🌐 Connect with Me:
    GitHub: github.com/Ish...
    Linkedin: / ishansawhney
    #GFG #POTD #geeksforgeeks #problemoftheday #c++

КОМЕНТАРІ • 13

  • @sweabhishek
    @sweabhishek 3 місяці тому

    Bro teri level of understanding bohot acchi hai how you achieve this level of knowledge are you iitian of what

    • @CodeGenius316
      @CodeGenius316  3 місяці тому +1

      Thanks bro...no I'm not iitian
      All this can be achieved by regular practice 😊

  • @shah4304
    @shah4304 3 місяці тому

    Nice 👍

  • @souravsingh7635
    @souravsingh7635 3 місяці тому

    int covverage(vector &matrix)
    {
    int r = matrix.size();
    int c = matrix[0].size();
    int sum = 0;
    for (int i = 0; i < r; i++)
    {
    for (int j = 0; j < c; j++)
    {
    if (matrix[i][j] == 0)
    {
    if (j > 0 && matrix[i][j - 1] == 1) // left element
    {
    sum += 1;
    }
    if (i < r - 1 && matrix[i][j + 1] == 1) //right element
    {
    sum += 1;
    }
    if (i > 0 && matrix[i - 1][j] == 1) // upside element
    {
    sum += 1;
    }
    if (i < r - 1 && matrix[i + 1][j] == 1) // downside element
    {
    sum += 1;
    }
    }
    }
    return sum;
    }
    } bhai ye code chal to gaya but muje right side element and downside element mai i < r - 1 , j < c - 1 ye boundary cases ka logic samaj nahi aya can you help in this

    • @CodeGenius316
      @CodeGenius316  3 місяці тому +1

      Bhai ye code same mere Wale jaisa hai...video dekho yehi cheez smjha rkhi hai maine

  • @printfiamd5254
    @printfiamd5254 3 місяці тому

    class Solution {
    public:
    int findCoverage(vector& matrix) {
    // Code here
    int ans = 0;
    int n = matrix.size();
    int m = matrix[0].size();
    for(int i = 0; i < n; i++){
    for(int j = 0; j < m-1; j++){
    ans+=matrix[i][j]^matrix[i][j+1];
    }
    }
    for(int i = 0; i < m; i++){
    for(int j = 0; j < n-1; j++){
    ans+=matrix[j][i]^matrix[j+1][i];
    }
    }
    return ans;
    }
    };
    I have tried this approach and works correctly. Just basic XOR operation.

  • @mayankmishra7520
    @mayankmishra7520 3 місяці тому

    Very helpful video! The explanation is clear and easy to understand. Great job!

  • @sapthasagar7840
    @sapthasagar7840 3 місяці тому

    Thanks for sharing explanation bro 💜