90-Day Coding Challenge: Solved Merge Intervals with Sorting

Day 48 of My 90-Day Coding Challenge Today I solved Merge Intervals, and this one was tricky until I truly visualized what was happening. At first, the logic didn’t click. But once I started thinking in terms of interval overlap on a number line, everything became much clearer. Key concepts I learned today: • Sorting based on starting index using a comparator • Understanding how sorting simplifies complex problems • Merging intervals by tracking the current start and end range The biggest realization: Without sorting, this problem is messy. With sorting, it becomes structured and manageable. Also got hands-on with: • Writing a custom comparator • Using Arrays.sort() effectively for 2D arrays Key takeaway: Some problems feel hard not because of logic, but because you’re not visualizing them correctly. Once the visualization is clear, the solution becomes almost obvious. #90DaysOfCode #DSA #Java #LeetCode #Sorting #ProblemSolving

  • text

To view or add a comment, sign in

Explore content categories