Number of islands | Leetcode

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 378

  • @akshatjain6854
    @akshatjain6854 4 года назад +249

    I don't know how to thank you . We are paying money in lacs to college still they don't teach anything. But you are giving us these amazing explanation for free. Thank you so much brother. Keep making videos

    • @techdose4u
      @techdose4u  4 года назад +9

      Thanks bro :)

    • @johnwick-gj9gb
      @johnwick-gj9gb 4 года назад +4

      well said man.

    • @akshatjain6854
      @akshatjain6854 4 года назад +5

      @@johnwick-gj9gb yup he deserves it

    • @aakashkatiyar5005
      @aakashkatiyar5005 3 года назад +2

      just say "T H A N K Y O U ! ! !" XD

    • @pkyadav6230
      @pkyadav6230 2 года назад

      in reality colleges have become randi khhana..u go and pick a girl

  • @gauravsrivastavjsr
    @gauravsrivastavjsr 4 года назад +54

    Your way of solving problems is easy to understand .. thank you for such a nice contents.

  • @HarkiratSaluja
    @HarkiratSaluja 4 года назад +9

    I went over leetcode explanation, did not get it. Then i went over few of you tube videos where they just solved the question giving minimal explanation. Then i bumped on this. Thank you so much brother. I was trying to understand DFS practically and this pretty much sums it out for a beginner like me. Thanks a bunch again.

  • @beketmyrzanov1979
    @beketmyrzanov1979 4 года назад +7

    You explain way better than some youtubers with thousands subs. Thank you, dude! Keep doing

  • @stupify6751
    @stupify6751 Год назад

    dude, you are the best teacher out there!!. Can call you as "Teacher" with out any spelling mistake!!

  • @shritishaw7510
    @shritishaw7510 2 года назад +14

    That's an extraordinary explanation mate. You made it look so simple. Thanks a lot.

  • @devesh819
    @devesh819 Год назад

    Literally u made be this question a cake walk for me . Never studied DFS but your Clear voice filled with knowledge taught me everything

  • @redleader2211
    @redleader2211 Год назад +1

    Great solution, and using the graph itself to store the visited state is a big brain move.

  • @He_ze
    @He_ze 11 месяцев назад

    I like your videos. You explain everything without skipping steps

  • @QuantumTick
    @QuantumTick 3 года назад +2

    good explanation, found a Indian programming tutorial gem :).

  • @KarthikaRaghavan
    @KarthikaRaghavan 2 года назад

    In 2022. This video had a the best explanation for this problem, handsdown! :)

  • @luobohu8128
    @luobohu8128 4 года назад +3

    thank you so much! I love your teaching style. Although many RUclipsrs did algorithm videos, some of them started coding at first without exquisite explanations, so I can't follow them. Thank you again bro.

  • @spetsnaz_2
    @spetsnaz_2 4 года назад +3

    There are so many videos on youtube for this problem. Your explanation is the best 🍻

  • @davidalexander2058
    @davidalexander2058 2 года назад +1

    Thank you for this crystal clear explanation! I could not follow other explanations found on the internet, but this was very clear.

  • @hemantsood9579
    @hemantsood9579 4 года назад +60

    I think the time complexity should be O(n * m) as we are traversing the whole matrix

    • @techdose4u
      @techdose4u  4 года назад +13

      Yes.

    • @abhishekjaiswal6492
      @abhishekjaiswal6492 3 года назад +1

      @@techdose4u but you told in the video the time complexity as O(n). Since we are using dfs for each element, so the time complexity must be greater than O(nxm).What's your opinion? Please clarify it if i am wrong

    • @abhishekjaiswal6492
      @abhishekjaiswal6492 3 года назад

      please reply

    • @abhishekshankar1136
      @abhishekshankar1136 3 года назад +1

      @@abhishekjaiswal6492 each recursive we will do maximum O( 1) work , so I think it's O(nm) , maybe it is > O(nm)

    • @eshaanbhat3732
      @eshaanbhat3732 3 года назад +3

      @@abhishekjaiswal6492 asume if it's O(m*n) than N = m*n then complexity is O(N) which is again linear time so instead of writing O(m*n) we can directly say it's of O(n)

  • @kumarpallav8156
    @kumarpallav8156 3 года назад +5

    THE BEST explaination.

  • @AshwaniSharma-of2nq
    @AshwaniSharma-of2nq 2 года назад

    Great explanation with simple and efficient solution.

  • @shishpalvishnoi7974
    @shishpalvishnoi7974 4 года назад +2

    please make video on other graph algorithm.. your way of writing code and explaining is crystal clear.

    • @techdose4u
      @techdose4u  4 года назад

      Thanks...will do it soon

  • @575saisri4
    @575saisri4 4 года назад +2

    it is a blessing to have found your channel

    • @techdose4u
      @techdose4u  4 года назад

      :) when did you find it actually?

    • @575saisri4
      @575saisri4 4 года назад

      TECH DOSE recently not sure exactly when 😄

  • @ritikbhardwaj4061
    @ritikbhardwaj4061 4 года назад +4

    Thanks, TechDOSE for this amazing graph series...thanks a lot...

  • @KevinN44
    @KevinN44 3 года назад +3

    Thank you very much! You have a way of explaining things that makes it very easy to understand 👏🏾👏🏾

  • @saurabhsengar9520
    @saurabhsengar9520 4 года назад +6

    awesome bro...
    Another method I thought was to first find the indices of all the 1's and store it in list l.
    Then traverse through the list in dfs and keep on removing the elements from the list l if found ...
    But 😅one of the test case went out of time...46/47.

    • @techdose4u
      @techdose4u  4 года назад +2

      Nice..... This technique is something different.

  • @sohamdey2177
    @sohamdey2177 3 года назад +1

    Simply wow, one of the best solution.

  • @Jeremy-yb5yo
    @Jeremy-yb5yo 4 года назад +3

    You always give us the best explanation, Thank you!!!

  • @naveenkumar-ns9sg
    @naveenkumar-ns9sg 4 года назад +1

    No Words you are Awesome and Genius.. keep doing good problem vedios

    • @techdose4u
      @techdose4u  4 года назад

      Not genius...just consistent work :)

  • @snehasoni1392
    @snehasoni1392 7 месяцев назад

    it was literally a crystal clear explanation for this question
    thanku TechDose
    u just made my day.....

  • @kirthe1116
    @kirthe1116 Год назад

    The best explanation. I have wasted 1 hour just by seeing other videos

  • @sajidali_6567
    @sajidali_6567 3 года назад +3

    Waiting for disjoint set implementation of the above problem.
    Btw Nice explanation! Thank you!!

  • @AruneshSrivastava
    @AruneshSrivastava 4 года назад +3

    This is good explanation, suppose if going diagonally is also allowed . then will this work if we just add these 4 more directions to the existing 4 directions
    mark_current_island(matrix,x-1,y-1,r,c); // LEFT UP DIAGONAL
    mark_current_island(matrix,x-1,y+1,r,c); //RIGHT
    UP DIAGONAL
    mark_current_island(matrix,x+1,y-1,r,c); //LEFT DOWN DIAGONAL
    mark_current_island(matrix,x+1,y+1,r,c); //RIGHT
    DOWN DIAGONAL

  • @RajeshS-n2j
    @RajeshS-n2j 2 месяца назад

    nicely explained and presented, thank you.

  • @radhu8
    @radhu8 3 года назад +6

    i recently started watching referring your videos. This one is amazing. Such a clear and neat explanation! Thank you for this.

  • @Siddharth-yi7pg
    @Siddharth-yi7pg 3 года назад +1

    Amazing level of explanation and speaking

  • @Venkat.devisetti
    @Venkat.devisetti 3 года назад +1

    Java Code is below
    ============
    public class NoOfIlands {
    public static void main(String[] args) {
    int noOfIlands = 0;
    int map[][]= {{1,1,0,0,0},{1,1,0,0,0},{0,0,1,0,0},{0,0,0,1,1}};
    int height = map.length;
    int width = map[0].length;

    for(int i=0;i

  • @kercat89
    @kercat89 4 года назад +3

    Beautifully explained!! Thank you very much for this!

  • @peter-eh2oq
    @peter-eh2oq 2 года назад

    OMG! Thanks!!!! Please Continue!!!!!!!!!!!!!!

  • @shivangishukla2629
    @shivangishukla2629 4 года назад +4

    You made this problem as easy as addition of two numbers!! Amazing explanation.

  • @rohitchauhan6170
    @rohitchauhan6170 2 года назад +1

    really nice explanation is an easy efficient way thanks a lot

  • @robertyoungie
    @robertyoungie 2 года назад +1

    Great little tutorial, simplified the problem for me

  • @saimeghanabarla9646
    @saimeghanabarla9646 Год назад

    Awesome ❤

  • @CengizAkarsu
    @CengizAkarsu 3 года назад +1

    very clear, visual, and direct explanation. Thank you, bro.

  • @rumaroy219
    @rumaroy219 2 года назад

    You are AMAZING!!!! Best and Simple Explanation!! I am kinda falling short of words! 😀 Thanks Bro.

  • @avadhootjoshi1805
    @avadhootjoshi1805 3 года назад +1

    Very calm explanation

  • @harshpatel1385
    @harshpatel1385 4 года назад +1

    your explanation technique is awesome.

  • @bestdeal3385
    @bestdeal3385 2 года назад +1

    best teacher best youtuber thank you sir😃😊

  • @decodingParinda
    @decodingParinda 4 года назад +1

    Couldn't have been more clearer.Thanks for it :)

  • @sahildadhich59
    @sahildadhich59 5 месяцев назад

    very nicely explained

  • @aniketwattamwar1514
    @aniketwattamwar1514 3 года назад +2

    Your content is really good.
    Easy to understand and it helps us to code based on that understanding.
    Please continue making videos.
    Thank you.

  • @kartikbadnorejain4708
    @kartikbadnorejain4708 3 года назад +1

    Awesome Explanation Sir .

  • @poojakhatri4426
    @poojakhatri4426 2 года назад

    Thank you so much!! I finally understood the problem!

  • @ashisbhowmik348
    @ashisbhowmik348 3 года назад +1

    Your explanation is no fire 🔥🔥🔥🔥🔥🔥

  • @varunajmera
    @varunajmera 2 года назад

    thanks for the amazing explanation. I was unable to find a good video but u explained very well.

  • @christophermcmahon9541
    @christophermcmahon9541 Год назад +1

    I have a benefited a lot from your videos, keep up the good work!

  • @rroy2812
    @rroy2812 3 года назад

    excellent explanation

  • @shirish2005
    @shirish2005 Год назад +1

    Best explaination

  • @MP-ny3ep
    @MP-ny3ep 2 года назад

    Awesome , top notch explanation. Thank you!

  • @ChandanKumar-em8zg
    @ChandanKumar-em8zg 2 года назад

    Awesome Explanation. Thanks Sir!

  • @malkarajk4093
    @malkarajk4093 4 года назад +2

    Sir really super amazing no words to express my happiness keep it up sir

  • @saurabhchauhan232
    @saurabhchauhan232 3 года назад

    Thank you, I am so afraid to start any problem that I even couldn't sum two diagonal problem which is easiest. Having around 7 yr of experience as web developer but they way you explain and the code you show made me little confident that logic is most important in this problems

  • @abhaytiwari6411
    @abhaytiwari6411 4 года назад +2

    keep it up ..
    welldone

  • @ManishKumar-ys5oj
    @ManishKumar-ys5oj 4 года назад +4

    your content helping a lot.....Upload daily more and more problems❤

  • @vivek.tiwary
    @vivek.tiwary 3 года назад +1

    Short and concise 👌👌👌👌

  • @apcs914
    @apcs914 Год назад

    good explaination

  • @ManinderSingh-xr6ir
    @ManinderSingh-xr6ir Год назад

    wonderful explaination

  • @openworld7585
    @openworld7585 4 года назад

    Thank you for very easy way explanations

  • @Highlights_Point
    @Highlights_Point 2 года назад +1

    Thnaks sir today i take dose of this question😂😅😅😅

  • @skypravda
    @skypravda 4 года назад +2

    Thank you, bro, for this clear explanation. 👍

  • @RajatAsthana24
    @RajatAsthana24 22 дня назад

    simple n best explanantion

  • @kannupriyasingh
    @kannupriyasingh 3 года назад +2

    Best explanation
    Thanku so much :)

  • @sunilthind3257
    @sunilthind3257 4 года назад +1

    Nice explanation. Thanks

  • @atultiwari1547
    @atultiwari1547 4 года назад

    good explanation

  • @shikharjaiswal6877
    @shikharjaiswal6877 3 года назад +1

    Superb man! Thanks, for your help.

  • @sergeykodzha2621
    @sergeykodzha2621 Год назад

    The time complexity is O(m*n). Also it's better to use stack instead of recursion.

  • @sgr2683
    @sgr2683 3 года назад +1

    Our good deeds come back to us, I hope that someday I will be able to pay you for this wonderful explaination..........++Thankyou:)

  • @ravikumarmathanya5369
    @ravikumarmathanya5369 3 года назад +1

    Matlab bhai tum kaam 1 No. kar rahe ho...bas itna hi kehna chahta hun

  • @manuramvelappan5935
    @manuramvelappan5935 4 года назад +1

    Excellent.. You explained it well...

  • @MirzaTalks36
    @MirzaTalks36 4 года назад +1

    Excellent solution

  • @kunalsoni7681
    @kunalsoni7681 4 года назад +1

    Thanking you sir 😊☺️.. to make this problem easy to understand 😊

  • @johnwick-gj9gb
    @johnwick-gj9gb 4 года назад +1

    great way of doing things ..awesome man

  • @amitpalsingh6401
    @amitpalsingh6401 3 года назад +1

    thanks guru ji

  • @anuragsandhu9590
    @anuragsandhu9590 4 года назад

    Javascript code:
    function Numberofislands(array) {
    let island = 0;
    for (let row = 0; row < array.length; row++) {
    for (let col = 0; col < array[row].length; col++) {
    if (array[row][col] === 1) {
    array[row][col] = 2;
    island++;
    if ((array[row][col - 1] && array[row][col - 1] === 2)
    || (array[row - 1] && array[row - 1][col] && array[row - 1][col] === 2)
    || (array[row + 1] && array[row + 1][col] && array[row + 1][col] === 2)
    || (array[row][col + 1] && array[row][col + 1] === 2)) {
    island--;
    }
    }
    }
    }
    return island;
    }

  • @Amit_Kumar_1999
    @Amit_Kumar_1999 4 года назад +7

    more specifically this is problem can be described as , find all of the connected component in the given graph.

  • @tanyamalhotra9505
    @tanyamalhotra9505 2 года назад +1

    amazing explanation! thankyou

  • @harshitsxxd
    @harshitsxxd 4 года назад +1

    Glad you made this video! great explanation.

  • @soneshengg
    @soneshengg 3 года назад +1

    Thanks!

  • @komirisrinathgoudkomiri1534
    @komirisrinathgoudkomiri1534 3 года назад +1

    Nice Explanation : )

  • @yuchenxiao3445
    @yuchenxiao3445 2 года назад

    Thank you for your video!

  • @KUSUMAKARSHUKLA
    @KUSUMAKARSHUKLA 2 года назад

    Thankyou very much. Can't thankyou more!!

  • @anybodycancode5093
    @anybodycancode5093 4 года назад +1

    best explanation

  • @AbhayKumarAgrawal
    @AbhayKumarAgrawal 4 года назад +2

    Thank u so much , all thanks for the way you solve , very easy and understandable, really thanks a lot.

  • @sweetsazd11
    @sweetsazd11 2 года назад

    Thank you, this was helpful :)

  • @RohitSharma-bu6lc
    @RohitSharma-bu6lc 4 года назад +1

    Can not thank you enough for the wonderful explanation.

  • @adityathapa
    @adityathapa 2 года назад

    Thanks man! It was just what I needed.

  • @azeezsayyad7281
    @azeezsayyad7281 4 года назад

    great explanation thanks

  • @worldwar_two2894
    @worldwar_two2894 Год назад

    well done!

  • @santerek28
    @santerek28 4 года назад +1

    Very Well expained sir ! thank you !

  • @mystica7284
    @mystica7284 4 года назад +1

    Awesome!!! Subscribed😅. Keep them coming.

  • @rimzim1032
    @rimzim1032 4 года назад +1

    Awesome explanation! Thank you!

  • @journeytowardslife9830
    @journeytowardslife9830 3 года назад +1

    Thank you so much for a detailed explanation 🙂

  • @varunnarayanan8720
    @varunnarayanan8720 4 года назад +1

    Well Explained

  • @mehulagarwal6063
    @mehulagarwal6063 3 года назад +1

    Amazing explanation, sir 🙏