LC 295. Find Median from Data Stream | Heap HARD | Explained
Автор: The Optimal Approach
Загружено: 2026-01-10
Просмотров: 10
Welcome to Day 6 of the 75 Hard DSA Challenge
In this video, I solve and explain LeetCode 295 – Find Median from Data Stream, a classic HARD problem based on the Two Heaps technique.
🔍 What you’ll learn in this video:
Why a single data structure is not enough for streaming median
How to use Max Heap and Min Heap together
Maintaining size balance between the two heaps
Ensuring ordering between left and right halves
Getting median in O(1) time after each insertion
🧠 Key Concept:
This problem is solved by maintaining two heaps, where the Max Heap stores the smaller half of numbers and the Min Heap stores the larger half.
The heaps are balanced such that their sizes are either equal or the Min Heap has exactly one extra element, allowing efficient median calculation.
📌 75 Hard sheet: https://docs.google.com/spreadsheets/...
📌 Problem Link: https://leetcode.com/problems/find-me...
📌 Solution Link: https://github.com/sibasundarj8/75-Ha...
If you find this helpful, consider liking the video and subscribing to follow the complete 75-day journey.
#leetcodehard #findmedianfromdatastream
#twoheaps #heap #priorityqueue #dsa
#75harddsachallenge #75hardchallenge
#75dayhardprogram #dsahardproblems
#leetcode295 #codinginterview #coding
#coding #dsainjava #dsa #dsahard
#leetcode295 #lc295 #datastream
#median #runningdatastream
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: