Yogesh ..’s Post

Day 14/100 | #100DaysOfDSA Today’s problem: Search a 2D Matrix At first glance, it looks like a 2D search problem… But the trick? Treat the matrix like a sorted 1D array. Since: • Each row is sorted • First element of every row > last element of previous row That means the entire matrix is globally sorted. Approach: • Apply Binary Search • Convert mid index → row = mid / n, col = mid % n • Compare and adjust pointers Time complexity: O(log(m × n)) Big takeaway: Sometimes the problem isn’t 2D at all — it’s just perspective. Stacking binary search patterns now. 🚀 #100DaysOfCode #LeetCode #DSA #Algorithms #BinarySearch #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity #SoftwareEngineer #ComputerScience #Consistency #Programmers #TechGrowth

  • graphical user interface, text

To view or add a comment, sign in

Explore content categories