Skip to content
Sharp

Functions · interview question

What is the healthiest performance judgment around batch helpers?

Multiple choiceHardchapter-2-curatedpremiumfunctionsbatch-helpers
python
def chunk_rows(rows: list[dict], size: int) -> list[list[dict]]:
    return [rows[index:index + size] for index in range(0, len(rows), size)]
Choose one answer
Answer and explanation

Correct answer

B. Measure before optimizing, then change the part that actually dominates cost instead of guessing from style alone.

Why

Premature optimization is usually weaker than targeted optimization backed by measurement.

Test yourself on Functions

A free test with instant, explained results. No account needed.

Start free test
All Functions questions →