Skip to content
Tech Interview Prep

Real Interview Questions for the Data Engineer at Mercado Libre

New

Interview Q&A

4 questions · Flow follows Relevance until this set has a learning order.

Q&A-1How would you solve a company logistics problem using artificial intelligence in a 15-minute group activity?

Reported in Entrevista MELI

The 2-minute answer

In 15 minutes I would not try to build a model. I would pick one logistics decision that gets made thousands of times a day, agree a baseline the business already trusts, and sketch the data path a model would need later. My pick would be the delivery date promised at checkout. A wrong promise costs twice: late deliveries bring refunds, cancellations and support load, and promises padded too far lose conversion. The same shape applies to Mercado Envios promises across markets.

I would state assumptions first: order events, carrier scan events and hub locations are in the warehouse, and nobody has a model yet. Then I would split the time:

MinutesOutput
0-2Problem, decision and owner named
2-5Metric and baseline from existing data
5-9Pipeline and features
9-12Simplest model that beats the baseline, and how it is checked
12-15Risks, rollout, what I would cut

Metric and baseline. On-time rate against the promised date, bucketed by promise type. The baseline is the current rule, for example median origin-to-destination lead time plus a fixed buffer. Hypothetical figures for the activity: baseline 88% on time with a mean 1.9 days of padding; target 93% on time at 1.4 days. Both numbers matter. A promise that is always one day late is as bad as one that is always early.

Pipeline. Scan events land in a raw table, get reduced to one row per shipment state change, and join to a shipment-level fact table keyed by shipment_id. Features are computed as of the promise timestamp. This is the point most groups miss: delivered_at is only known after the outcome, so using it leaks the label.

SQL
-- as-of features: only scans known when the promise was made
SELECT s.shipment_id,
       s.origin_hub,
       s.dest_postal_prefix,
       COUNT(e.event_id) FILTER (WHERE e.event_ts <= p.promised_at) AS scans_before_promise
FROM shipments s
JOIN promises p USING (shipment_id)
LEFT JOIN carrier_events e USING (shipment_id)
GROUP BY 1, 2, 3;

Model. Quantile regression at the 80th or 90th percentile of lead time, or a gradient-boosted model trained on that quantile. The business needs a promise met at a chosen confidence, not an average. A mean-based model misses roughly half its promises by construction, and I would say that explicitly in the room.

Failure modes and detection.

  • Late-backfilled scans contaminate training. Detect by comparing event ingest time with event time and rejecting rows where the gap exceeds the carrier SLA.
  • Peak periods such as Cyber Monday make the training window unrepresentative. Detect by tracking weekly on-time rate against forecast and alerting when the gap exceeds a fixed threshold.
  • A hub outage moves every promise at once. Put a circuit breaker back to the baseline rule, keyed on hub health, so the model never sets promises for a hub that is down.

What I would cut. The AI framing. A rule plus a quantile model on a clean, as-of feature table beats a deep model that nobody can debug during a live incident, and it is the version I could defend to an engineering manager on day one.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2Design a Shopping Cart Checkout system.

Reported in MercadoLibre's Interview Process (2026)

The 90-second answer

I'd separate the cart from checkout. The cart is a mutable, cheap, per-session record. Checkout is a short workflow across pricing, inventory, payment and order creation. Those systems don't share a database, so I wouldn't wrap them in one transaction. I'd run checkout as an orchestrated saga keyed by a checkout_id that the client generates and sends as Idempotency-Key.

The steps: freeze the cart into a priced snapshot (line prices, tax, currency, FX rate and its timestamp), reserve stock with a hold that expires, authorise payment, then create the order and confirm the reservation. Every step appends an event to a log. The data platform reads that log, and the order service reads it too.

Trace (hypothetical figures)

t=0ms     POST /checkout  Idempotency-Key=ck_91a  cart=c_77  items=3
t=40ms    snapshot_created  total=1249.00 ARS  snapshot=s_12
t=95ms    reserve sku=A1 qty=2 -> ok  hold_expires=t+15m
t=310ms   payment authorize -> pending  provider_ref=p_553
t=2.4s    webhook payment.approved p_553  (provider retried once)
t=2.41s   order_created o_901  reservation confirmed
t=2.42s   201 Created  Location: /orders/o_901

Failure modes and how they show up

  • The client times out after authorisation but before the 201. The retry carries the same key, so the stored response returns o_901. No second charge. Detection: a spike in replayed keys, which should be steady, not growing.
  • The payment webhook arrives twice. The consumer dedupes on the provider event id for at least 72 h. Detection: duplicate-event rate per provider.
  • The hold expires before payment confirms. The saga voids the authorisation and returns 409 stock_changed rather than overselling. Detection: reservation expiry rate by SKU.
  • The price moves mid-checkout. The snapshot governs. Any difference returns 409 with the new total. The system never charges a different amount silently.

Data side

Events carry checkout_id, snapshot_id, step, occurred_at and a per-checkout sequence number. The warehouse keeps one row per checkout holding the latest state. Late webhooks update that state but never add revenue twice, because revenue is recognised on payment.approved keyed by provider event id. Reconcile daily: approved authorisations in the provider settlement report against order totals. Any gap opens an incident.

Trade-offs

A saga with compensating steps is more code than one transaction. A single transaction spanning inventory and an external payment provider isn't possible, so the extra code is the price. The hold length trades conversion against oversell risk. I'd set it from the payment p99 plus margin. If card authorisation p99 is 2.5 s, a 15 min hold mostly protects against shoppers who abandon, so I'd look at the abandonment curve before tuning it lower.

What I'd watch

Checkout p99, reservation expiry rate, webhook duplicate rate and the daily reconciliation gap. The gap matters most, since it's the only one that proves money and orders still agree.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3Build and deploy a small API that scans DNA strings for a repeated pattern.

Reported in www.designgurus.io › answers › detailWhat Is the Mercado Libre Interview Process Like? (Round by ...

The 90-second answer

First I pin down "repeated pattern". I take it as a fixed-length substring (a k-mer) over A, C, G, T that occurs at least twice, with overlapping occurrences counted. I also ask for the response shape and the input limits, because the input is untrusted. I validate the alphabet and length before doing any work.

The scan is one pass with a hash map from each k-mer to its start positions. Each slice copies k characters, so time is O(n·k). Memory grows with the number of distinct k-mers, which is up to n. That is fine at request-sized inputs and wrong for genome-sized ones, which belong in a batch job.

Python
from collections import defaultdict
import re
from fastapi import FastAPI
from pydantic import BaseModel, Field, field_validator

app = FastAPI()
ALPHABET = re.compile(r'^[ACGT]+$')

class ScanRequest(BaseModel):
    sequence: str = Field(max_length=1_000_000)
    k: int = Field(ge=1, le=64)

    @field_validator('sequence')
    @classmethod
    def only_acgt(cls, v: str) -> str:
        v = v.upper()
        if not ALPHABET.match(v):
            raise ValueError('sequence must contain only A, C, G, T')
        return v

@app.post('/scan')
def scan(req: ScanRequest):
    s, k = req.sequence, req.k
    positions = defaultdict(list)
    for i in range(len(s) - k + 1):
        positions[s[i:i + k]].append(i)
    repeated = {km: pos for km, pos in positions.items() if len(pos) > 1}
    return {
        'k': k,
        'repeated_kmers': len(repeated),
        'positions': dict(list(repeated.items())[:50]),
    }

Pydantic returns 422 for a bad alphabet or an oversized body, so malformed input never reaches the loop.

Trace (hypothetical input). sequence = "ACGTACGT", k = 4. The windows are ACGT@0, CGTA@1, GTAC@2, TACG@3, ACGT@4. Only ACGT repeats, at [0, 4], so the response is repeated_kmers: 1.

Deployment. Run it under gunicorn -k uvicorn.workers.UvicornWorker with a few workers, and cap the request body at the reverse proxy (for example client_max_body_size 1m in nginx) so the 1,000,000-character validator is not the first line of defence. Set a request timeout at the proxy as well.

FailureDetected byResponse
Large input inflates memory (hypothetical: 1M windows at k=12 can mean hundreds of MB of Python objects)RSS per worker, OOM killsLower the length cap or move to batch
Event loop blocked by CPU workp99 latency jumps under concurrencyRun def endpoints in the threadpool, or offload to a worker
Bad input slips past validation5xx rate, error logsKeep the validator the only path into the loop

When not to use this. For full genome-scale data, the same counting belongs in a batch job: partition the files, count k-mers per partition with Spark or a columnar engine, then merge. For longest-repeat queries, a suffix array is the right structure, not a dict of lists. The API is only justified for small, interactive inputs.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4Build an in-memory rate limiter as a middleware.

Reported in interview-rounds/content/interviews/mercado-libre-5.md at main · sumitsingh4411/interview-rounds

The 90-second answer

I'd use a token bucket keyed by client identity, stored in a dict guarded by a lock, wrapped in ASGI middleware that returns 429 with Retry-After. Before writing it I'd confirm three things: the key (API key, user id, or client IP taken only from a trusted proxy hop), the rate and burst (I'll assume 5 requests/s with a burst of 10), and whether one process is enough. The state lives in one process, so with N instances behind a load balancer the effective limit can reach N times the configured one. That is fine for abuse protection and wrong for billing.

Python
import math, threading, time
from collections import OrderedDict

class TokenBucketLimiter:
    def __init__(self, rate, capacity, max_keys=100_000, clock=time.monotonic):
        self.rate, self.capacity, self.max_keys = rate, capacity, max_keys
        self.clock = clock
        self._buckets = OrderedDict()  # key -> [tokens, last_seen]
        self._lock = threading.Lock()

    def allow(self, key):
        now = self.clock()
        with self._lock:
            tokens, last = self._buckets.pop(key, (self.capacity, now))
            tokens = min(self.capacity, tokens + (now - last) * self.rate)
            if tokens >= 1:
                allowed, retry = True, 0.0
                tokens -= 1
            else:
                allowed, retry = False, (1 - tokens) / self.rate
            self._buckets[key] = (tokens, now)  # re-insert at MRU end
            if len(self._buckets) > self.max_keys:
                self._buckets.popitem(last=False)  # evict LRU key
            return allowed, retry

class RateLimitMiddleware:
    def __init__(self, app, limiter, key_fn):
        self.app, self.limiter, self.key_fn = app, limiter, key_fn

    async def __call__(self, scope, receive, send):
        if scope["type"] != "http":
            return await self.app(scope, receive, send)
        ok, retry = self.limiter.allow(self.key_fn(scope))
        if ok:
            return await self.app(scope, receive, send)
        body = b'{"code":"rate_limited"}'
        await send({"type": "http.response.start", "status": 429, "headers": [
            (b"content-type", b"application/json"),
            (b"retry-after", str(math.ceil(retry)).encode()),
            (b"content-length", str(len(body)).encode())]})
        await send({"type": "http.response.body", "body": body})

Why these choices: time.monotonic cannot go backwards when NTP steps the wall clock, so refill arithmetic stays correct. A token bucket is O(1) per request and allows a burst up to capacity, which fixed windows do not handle cleanly. A fixed window of 5/s can admit 10 requests in the second straddling a boundary, twice the intended rate.

Trace. rate=5, capacity=10. At t=0 a client sends 12 requests. Requests 1 to 10 drain the bucket to 0. Request 11 finds 0 tokens, so retry = (1 - 0) / 5 = 0.2 s, and the middleware sends 429 with Retry-After: 1. Request 12 is also denied. At t=0.4 the bucket has refilled 0.4 × 5 = 2 tokens, so exactly two more requests pass.

OptionLimit scopeCost per requestUse when
In-memory token bucket (this)per process~1 µs under lockabuse protection, single instance, tests
Fixed window in Redis (INCR + EXPIRE)globalone network round tripglobal quota across fleet
Redis token bucket via Lua scriptglobal, burst-awareone round trip, atomicshared limits that need bursts
Gateway or load balancer limitsper edge routenone in-appcoarse protection before services

Failure modes and how to detect them

  • Unbounded key growth. Spoofed X-Forwarded-For values create a new key per request. The max_keys cap bounds memory. Alert on len(_buckets) pinned at the cap, and on the eviction rate.
  • Shared egress IP. Carrier NAT or a proxy makes thousands of users look like one client, so one noisy user gets everyone throttled. Detect it as a 429 spike concentrated on a single IP.
  • Lock contention. The critical section is a few dict operations, so the lock is held for microseconds. If p99 rises with QPS, measure lock wait time before blaming the algorithm, and shard the dict by key hash.
  • Silent fleet multiplication. Five pods means up to five times the limit. Put the per-instance rate in config as global_rate / replicas only if the replica count is fixed, and say so in the design.

Curated: · Written: · Reviewed:

Difficulty: Hard

Curated: · Written: · Reviewed: