Topological Sort and Strongly Connected Components: Interview Patterns for Directed Graphs (2025)
Topological Sort A topological ordering of a directed acyclic graph (DAG) is a linear ordering of vertices such that for […]
Topological Sort A topological ordering of a directed acyclic graph (DAG) is a linear ordering of vertices such that for […]
The Problem with Distributed Transactions In a monolith, a database transaction is atomic: either all changes commit or all roll
Core Entities Metric: metric_id, name, type (COUNTER, GAUGE, HISTOGRAM), unit, description, owner_id, created_at. DataPoint: metric_id, timestamp, value (DOUBLE), tags (key-value
When Number Theory Appears in Interviews Number theory problems appear in interviews at companies like Google, Facebook, and competitive programming
Core Entities Survey: survey_id, owner_id, title, description, status (DRAFT, ACTIVE, CLOSED), settings (allow_multiple_responses, anonymous, show_progress_bar), created_at, closes_at. Question: question_id, survey_id,
Core Entities ContentType: type_id, name (Article, Page, Product), fields_schema (JSON schema defining the fields). Content: content_id, type_id, slug, status (DRAFT,
What Is a Minimum Spanning Tree? A Minimum Spanning Tree (MST) of a weighted undirected graph is a spanning tree
Core Entities User: user_id, username, display_name, bio, avatar_url, follower_count, following_count, created_at. Post: post_id, author_id, content, media_urls[], like_count, comment_count, share_count, visibility
Choosing the Right Algorithm Decision tree: non-negative weights? -> Dijkstra (O((V+E) log V)). Negative weights, no negative cycles? -> Bellman-Ford
Core Entities Order: order_id, user_id, symbol, side (BUY, SELL), order_type (MARKET, LIMIT, STOP_LIMIT, TRAILING_STOP), quantity, limit_price, stop_price, status (PENDING, PARTIALLY_FILLED,
Monotonic Stack Concept A monotonic stack maintains elements in strictly increasing or decreasing order. Elements that violate the order are
What Is a Feature Store? A feature store is a centralized platform for computing, storing, serving, and sharing ML features.
Core Entities Subscriber: subscriber_id, user_id, plan_id, status (ACTIVE, PAUSED, CANCELLED), billing_cycle_anchor, next_billing_date, shipping_address, preferences[], skip_count. Plan: plan_id, name, price_cents, billing_interval
Core Entities Restaurant: restaurant_id, name, address, geo_location, cuisine_type, is_open, prep_time_minutes, delivery_radius_km. MenuItem: item_id, restaurant_id, name, price_cents, category, is_available, customizations[]. Order:
Core Entities Provider: provider_id, name, specialty, clinic_id, npi_number, languages[], accepts_new_patients. ProviderSchedule: schedule_id, provider_id, day_of_week, start_time, end_time, slot_duration_minutes, is_active. Appointment: appointment_id,