Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan

Edge Cases and Tenfold Scale

HardSystem Design00:00
Practice interviewer
In session
5 left
00:00

Your question is Edge Cases and Tenfold Scale. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Odeko turns each day's coffee shop orders into purchase orders sent to suppliers. Here is the function that rolls up every café's line items into per-supplier case counts.

def build_purchase_orders(daily_orders, supplier_catalog):
    purchase_orders = {}
    for order in daily_orders:
        for line in order["items"]:
            sku = line["sku"]
            quantity = line["quantity"]
            supplier = None
            for catalog_entry in supplier_catalog:
                if catalog_entry["sku"] == sku:
                    supplier = catalog_entry["supplier"]
                    break
            if supplier not in purchase_orders:
                purchase_orders[supplier] = {}
            if sku not in purchase_orders[supplier]:
                purchase_orders[supplier][sku] = 0
            purchase_orders[supplier][sku] += quantity
    for supplier, skus in purchase_orders.items():
        for sku, total in skus.items():
            case_size = 12
            skus[sku] = total // case_size
    return purchase_orders

How does this solution handle edge cases, and how would you scale this implementation if the number of cafés and daily orders increased tenfold? Walk through what you would check for and what you would change.