Find Median from Data Stream — Two-Heap Streaming Pattern
Solve LeetCode 295 Find Median from Data Stream with two heaps (max-heap for low half, min-heap for high half) giving O(log n) addNum and O(1) findMedian. A FAANG streaming classic.
12 articles
Solve LeetCode 295 Find Median from Data Stream with two heaps (max-heap for low half, min-heap for high half) giving O(log n) addNum and O(1) findMedian. A FAANG streaming classic.
LeetCode 1032 — design a class that returns true whenever the suffix of a streamed character sequence matches any dictionary word. Solved with a reverse trie and a bounded sliding buffer in O(W) per query.
Use Next.js loading.tsx and React Suspense to stream content progressively, show skeleton screens instantly, and improve perceived performance for data-heavy pages.
Master Server-Sent Events for server-to-client streaming in Node.js with TypeScript. Covers event format, reconnection, authentication, and LLM token streaming patterns used in 2026.
Reduce API payload sizes and latency through compression, streaming, pagination, and field selection. Master bandwidth optimization for global users.
gRPC streaming types: server→client for real-time data, client→server for uploads, bidirectional for chat. Binary, low-latency, flow-controlled, and better than REST.
Build real-time AI systems with Kafka as your event backbone. Ingest features, trigger training, distribute model outputs, and sync data to vector DBs at scale.
Master consumer groups, offset management, exactly-once semantics, dead-letter queues, and consumer lag monitoring for production Kafka.
Build fast UX with LLM streaming using Server-Sent Events, handle backpressure correctly, measure TTFT/TBT, and avoid common pitfalls in production.
Building real-time AI streaming: SSE vs WebSockets, streaming through load balancers, Redis pub/sub, backpressure, and Next.js App Router integration.
SSE is simpler than WebSockets: HTTP, auto-reconnect, one-way streaming. Perfect for dashboards, AI responses, and server→client updates. Learn when to use it.
Master the Vercel AI SDK for building production AI features in Next.js. Learn tool calling, streaming, structured output, and error handling patterns.