#Leetcode

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024

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

  • @RAHULYADAV-zr5fq
    @RAHULYADAV-zr5fq 2 ปีที่แล้ว +6

    this is the explanation I was looking for !!. thanks, Beauty with brain!!.

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

    Hey Alisha... great explanation. Thanks for the video. I appreciate your effort.

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

    Amazing walkthrough on DFS through matrix! Thanks!

  • @pankajkumarray6716
    @pankajkumarray6716 3 ปีที่แล้ว +2

    You have put lot of efforts, thanks for explaining. Helpful.

  • @sarankumaar6009
    @sarankumaar6009 2 ปีที่แล้ว +1

    your videos are gem no matter wat other video give.

  • @ahmedanwer6899
    @ahmedanwer6899 ปีที่แล้ว

    thanks for going deep with the depth first search traversal

  • @gitanjalikumari9262
    @gitanjalikumari9262 2 ปีที่แล้ว +1

    This is one of the best explanation for this problem.. thank you😊

  • @smartswaggy6114
    @smartswaggy6114 2 ปีที่แล้ว +6

    Fantastic video Alisha mam. I love the way you explain and handle the unprecedented situation like laptop hanging. This qn is quite easy to do but explaining it to others is a difficult task. You nailed it in explanation. I have become your fan :)

  • @yynnooot
    @yynnooot 2 ปีที่แล้ว +1

    Thank you for the step-by-step explanation!

  • @redlatming2136
    @redlatming2136 3 ปีที่แล้ว +2

    This explanation was amazing! Been searching for a long time. Thanks!

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

    One correction - In line 22 you should change row( 2nd paramater) to matrix.size() -1 and column(third parameter) of fnc to i since we are traversing on the last row of grid.

  • @maddycoder1294
    @maddycoder1294 2 ปีที่แล้ว +3

    nice explaination di

  • @tarunmali6228
    @tarunmali6228 2 ปีที่แล้ว +4

    Hi Ma'am, you definitely make the best leetcode solutions!!! Your channel deserves more subscribers!! Your channel will boom one day similar to Nick White

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

    Can you discuss about the complexity as well??

  • @pankajgoel3689
    @pankajgoel3689 2 ปีที่แล้ว

    amazing step by step explaination

  • @II-ii2um
    @II-ii2um 3 ปีที่แล้ว +1

    Welcome back :)

  • @Daksh-dz7hk
    @Daksh-dz7hk 4 หลายเดือนก่อน

    Best video 💪

  • @utkarshkanungo5092
    @utkarshkanungo5092 2 ปีที่แล้ว +1

    wow thanks.... 32:34 struggle is real

  • @adhed_engineer
    @adhed_engineer 2 ปีที่แล้ว +1

    great stuff

  • @lalitagarwal9155
    @lalitagarwal9155 ปีที่แล้ว +1

    // SIMPLE C++ USING BFS 99.64% faster
    class Solution {
    public:
    int rows,columns;
    vectormovements{{1,0},{-1,0},{0,1},{0,-1}};
    bool isValid(int r,int c){
    return r>=0 and r=0 and c=heights[r][c] and sea[nr][nc]!=1){
    q.push({nr,nc});
    }
    }
    }
    }
    vector pacificAtlantic(vector& heights) {
    rows=heights.size(),columns=heights[0].size();
    queueq1,q2;
    vectorres,pacific(rows,vector(columns,0)),atlantic(rows,vector(columns,0));
    for(int i=0;i

  • @codeculture2
    @codeculture2 3 ปีที่แล้ว +1

    great explanation! thanks a lot.

  • @reshmaparveen6679
    @reshmaparveen6679 3 ปีที่แล้ว +1

    Great explanation ❤️

  • @shubhamkale5003
    @shubhamkale5003 2 ปีที่แล้ว

    Vary well explained

  • @sundeepkumar3871
    @sundeepkumar3871 2 ปีที่แล้ว +1

    great explanation

  • @gauravsharma1251
    @gauravsharma1251 2 ปีที่แล้ว +1

    great

  • @abhishek04204
    @abhishek04204 2 ปีที่แล้ว +1

    good explanation, how did you comeup with that idea,how can we develop to think that way.
    Thank you!

    • @probabilitycodingisfunis1
      @probabilitycodingisfunis1  2 ปีที่แล้ว +2

      Keep practicing more variety of problems and that will help to develop thinking

  • @SlokAks
    @SlokAks 2 ปีที่แล้ว +1

    Same questions mentioning RED and BLUE lakes in interviewbit... BFS solution to above approach..
    #define RED 1
    #define BLUE 0
    vector dx = {1, -1, 0, 0};
    vector dy = {0, 0, 1, -1};
    int m, n;
    vector visA, visB;
    bool isValid(int i, int j) {
    return i >= 0 && j >= 0 && i < m && j < n;
    }
    void bfs(vector &A, int i, int j, bool lake) {
    vector &vis = (lake == BLUE ? visA : visB);
    queue q;
    q.push({i, j});
    int x, y;
    while(!q.empty()) {
    tie(i, j) = q.front();
    q.pop();
    if(vis[i][j])
    continue;
    vis[i][j] = 1;
    for(int k = 0; k < 4; k++) {
    x = i + dx[k];
    y = j + dy[k];
    if(isValid(x, y) && A[x][y] >= A[i][j]) {
    q.push({x, y});
    }
    }
    }
    }
    int Solution::solve(vector &A) {
    m = A.size(), n = A[0].size();
    int ans = 0;
    visA = visB = vector (m, vector (n, 0));
    for(int j = 0; j < n; j++) {
    bfs(A, 0, j, BLUE);
    bfs(A, m-1, j, RED);
    }
    for(int i = 0; i < m; i++) {
    bfs(A, i, 0, BLUE);
    bfs(A, i, n-1, RED);
    }
    for(int i = 0; i < m; i++) {
    for(int j = 0; j < n; j++) {
    if(visA[i][j] && visB[i][j]) {
    ans++;
    }
    }
    }
    return ans;
    }

  • @onkar1108
    @onkar1108 2 ปีที่แล้ว

    Great explanation !! Watching your explanations, the way you approach the problem matches with my thinking, so I love to watch your explanations. I can relate to the approach unlike other explanations on YT. Kudos to you. Definitely your channel is under valued but surely its gonna boom in the near future.

  • @shvmsh20
    @shvmsh20 2 ปีที่แล้ว

    crystal clear

  • @sahiltest7309
    @sahiltest7309 2 ปีที่แล้ว +1

    i just don t know how you guys think these things

  • @tejasjadhav8018
    @tejasjadhav8018 2 ปีที่แล้ว

  • @loveleshbhagat1114
    @loveleshbhagat1114 2 ปีที่แล้ว

    class Solution {
    public:
    int dx[4] = {0,1,0,-1};
    int dy[4] = {1,0,-1,0};
    void dfs(int i,int j,int z,vector& heights,vector&reach){
    reach[i][j][z]=1;
    for(int k=0;k=0 && ni=0 && nj

  • @vinaygoswami5374
    @vinaygoswami5374 2 ปีที่แล้ว

    This question took 2 hrs, but i was not able to solve it using brute force

  • @maqsoodahmad-vx8jl
    @maqsoodahmad-vx8jl ปีที่แล้ว

    Thanks but really need hindi teacher 😢