Search a 2D matrix (LeetCode 74) | Full solution with visual examples and proof

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • Actual Problem: leetcode.com/problems/search-...
    Chapters:
    00:00 - Intro
    00:44 - Problem Statement and Description
    02:50 - Different ways to approach the problem
    05:30 - Efficient Solution
    08:49 - Dry-run of Code
    11:16 - Final Thoughts
    📚 Links to topics I talk about in the video:
    Binary Search: • Binary Search Algorith...
    Divide and Conquer Paradigm: • Divide and Conquer alg...
    What is Big O?: • Big O Notation Simplif...
    Binary Search Tree: • What is a Binary Searc...
    Spiral Matrix: • Spiral Matrix (LeetCod...
    📘 A text based explanation is available at: studyalgorithms.com
    Code on Github: github.com/nikoo28/java-solut...
    Test-cases on Github: github.com/nikoo28/java-solut...
    📖 Reference Books:
    Starting Learn to Code: amzn.to/36pU0JO
    Favorite book to understand algorithms: amzn.to/39w3YLS
    Favorite book for data structures: amzn.to/3oAVBTk
    Get started for interview preparation: amzn.to/39ysbkJ
    🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
    🎥 My Recording Gear:
    Recording Light: amzn.to/3pAqh8O
    Microphone: amzn.to/2MCX7qU
    Recording Camera: amzn.to/3alg9Ky
    Tablet to sketch and draw: amzn.to/3pM6Bi4
    Surface Pen: amzn.to/3pv6tTs
    Laptop to edit videos: amzn.to/2LYpMqn
    💻 Get Social 💻
    Follow on Facebook at: / studyalgos
    Follow on Twitter at: / studyalgorithms
    Follow on Tumblr at: / studyalgos
    Subscribe to RSS feeds: studyalgorithms.com/feed/
    Join fan mail: eepurl.com/g9Dadv
    #leetcode #programming #interview

Komentáře • 15

  • @user-xx6dv1tz2j
    @user-xx6dv1tz2j Před rokem +6

    Your teaching was just amazing .Please continue these Problem Solving sessions

  • @mohammedharoon1167
    @mohammedharoon1167 Před 5 měsíci

    saved my day nice explanation 👍

  • @ChristForAll-143
    @ChristForAll-143 Před 11 měsíci

    CAN YOU PLEASE CREATE A PLAYLIST FOR INTERVAL PROBLEMS - I DON'T FIND ANY U TUBER DOES THAT

    • @nikoo28
      @nikoo28  Před 11 měsíci

      once I have a bunch of problems on intervals, I will put them in a playlist for sure

    • @ChristForAll-143
      @ChristForAll-143 Před 11 měsíci

      @@nikoo28 Thanks a lot brother, if you want any questions will share here?

  • @AlexTopGT
    @AlexTopGT Před 8 měsíci +1

    can anyone explain why this solution is not O(log m) + O(log n)?

    • @sharaabsingh
      @sharaabsingh Před 7 měsíci +1

      This is the law of logarithms.
      Log(A) + Log(B) = log(A*B)

    • @nikoo28
      @nikoo28  Před 7 měsíci +1

      Perfect answer

  • @khushaldodeja8267
    @khushaldodeja8267 Před 5 měsíci

    getting time limit exceeded

    • @khushaldodeja8267
      @khushaldodeja8267 Před 5 měsíci

      Code I have written
      class Solution {
      public boolean searchMatrix(int[][] matrix, int target) {
      int i = 0, j = matrix.length-1;
      int mid;
      int potentialRow=-1;
      while(imatrix[mid+1][0]){
      i = mid+1;
      }
      else if(target

    • @nikoo28
      @nikoo28  Před 4 měsíci +1

      look at the code on github, it is available in video description

  • @kolawoleabdulrahman
    @kolawoleabdulrahman Před 10 měsíci

    cool look. great video. lets get started😆

  • @codinghero2001
    @codinghero2001 Před rokem +2

    Your teaching was just amazing .Please continue these Problem Solving sessions