Mastering DSA with Java: Day 30

🚀 #Day30/300 — Mastering DSA Challenge Continuing my 300-day journey to strengthen my Data Structures & Algorithms skills using Java. 📌 Daily Goals • Solve at least 1 problem every day • Focus on pattern recognition and optimized solutions • Share consistent learning updates along the journey 🧠 Today’s Problem: Find Median from Data Stream Solved this problem using the Two Heaps approach (Max Heap + Min Heap). Maintained one heap for the smaller half of elements and another for the larger half to efficiently calculate the median at any point. 💡 Key Takeaways: • Use Max Heap for the left half and Min Heap for the right half • Balance both heaps to maintain size difference ≤ 1 • Median can be retrieved in O(1) time • Time Complexity per insertion: O(log n) This problem strengthened my understanding of heap balancing, stream processing, and real-time median calculation. Staying consistent and improving every day in this 300-day DSA journey. 💪 #DSA #Java #ProblemSolving #BackendDeveloper #FullStackDeveloper #300DaysChallenge #LearningInPublic #Heap #PriorityQueue #Algorithms #SDE #React #ReactNative #JavaFullStack #SpringBoot

  • text

To view or add a comment, sign in

Explore content categories