NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

Design a system to analyze two days of purchase logs and compute trust scores for new purchases.

Implement the PurchaseAnalyzer class:

  • PurchaseAnalyzer(logsDay1: List[List[str]], logsDay2: List[List[str]]) Build per-user history from two days of logs. Each log row is [date, userId, orderType, amount], where amount is string.

  • List[str] crossDayDiverseUsers() Return the lexicographically-sorted list of userIds that

    • appear in both days, and
    • have at least two distinct orderType across the two days combined.
Test Cases
Input
Output
Expected