Search 2D Matrix with LeetCode

Day 18 of my LeetCode Journey: Problem: Search in a 2D Matrix Approach: Started from the top-right corner of the matrix. At each step: If the value is greater than target → move left If smaller → move down If equal → found the target This works because rows and columns are both sorted, allowing us to eliminate one row or column at every step. Time Complexity: O(m + n) Space Complexity: O(1) Key insight: Using matrix properties smartly can avoid unnecessary binary searches. Using matrix properties smartly can avoid unnecessary binary searches. On to Day 19 💪 #LeetCode #DSA #Java #ProblemSolving #CodingJourney #Consistency #1001DaysOfCode

  • graphical user interface, application

Good consistency, Keep it going.

Like
Reply

To view or add a comment, sign in

Explore content categories