Search a 2D matrix (LeetCode 74) | Full solution with visual examples and proof
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
Your teaching was just amazing .Please continue these Problem Solving sessions
saved my day nice explanation 👍
Glad it helped!
CAN YOU PLEASE CREATE A PLAYLIST FOR INTERVAL PROBLEMS - I DON'T FIND ANY U TUBER DOES THAT
once I have a bunch of problems on intervals, I will put them in a playlist for sure
@@nikoo28 Thanks a lot brother, if you want any questions will share here?
can anyone explain why this solution is not O(log m) + O(log n)?
This is the law of logarithms.
Log(A) + Log(B) = log(A*B)
Perfect answer
getting time limit exceeded
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
look at the code on github, it is available in video description
cool look. great video. lets get started😆
hahaha... 😄
Your teaching was just amazing .Please continue these Problem Solving sessions