PracHub
QuestionsLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Affirm

Analyze Returning Borrowers Across Two Days of Logs

Last updated: Jul 18, 2026

Quick Overview

Analyze two days of loan activity to find users who appear on both days and have at least two distinct loan types across their combined records. Retain an extensible per-user aggregate for an injected trust policy, with clear duplicate, ordering, complexity, and test semantics.

  • medium
  • Affirm
  • Data Manipulation (SQL/Python)
  • Software Engineer

Analyze Returning Borrowers Across Two Days of Logs

Company: Affirm

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

# Analyze Returning Borrowers Across Two Days of Logs You receive two collections of loan-activity records, one for each of two consecutive days. Each record contains `user_id` and `loan_type`; the same pair may appear multiple times. Design a Python solution that: 1. Returns the users who appear on both days and have at least two distinct loan types across the union of both days. 2. Builds a per-user aggregate that can be passed to an interviewer-supplied `trust_policy(aggregate)` function without redesigning the first part. The trust formula is deliberately not specified. Treat the policy as an injected pure function; do not invent its business rules. Explain your data structures, result ordering, complexity, and how you would test the aggregation boundary. ### Clarifying Questions to Ask - Does “at least two loan types” apply to each day or to the two-day union? - Are duplicate records meaningful beyond presence? - What deterministic output order is required? - Which aggregate fields does the trust policy contract require? ### What a Strong Answer Covers - Correct eligibility logic with explicit day-membership, distinctness, duplicate, and ordering semantics - A clear, extensible aggregate rather than coupling to an unknown score formula - Explicit duplicate and ordering semantics - Complexity proportional to the input plus output, with focused tests for boundary cases ### Follow-up Questions 1. How would the design change for a rolling 30-day window? 2. How would you process logs that do not fit in memory? 3. What if trust policies are versioned and old scores must be reproducible? 4. Which checks prevent malformed records from silently changing eligibility?

Quick Answer: Analyze two days of loan activity to find users who appear on both days and have at least two distinct loan types across their combined records. Retain an extensible per-user aggregate for an injected trust policy, with clear duplicate, ordering, complexity, and test semantics.

Related Interview Questions

  • Analyze Loan Payments Using Pandas for Key Insights - Affirm (medium)
  • Write SQL for Transactions and Customers - Affirm (medium)
  • Implement and debug event filtering in Python - Affirm (medium)
|Home/Data Manipulation (SQL/Python)/Affirm

Analyze Returning Borrowers Across Two Days of Logs

Affirm logo
Affirm
Jul 14, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenData Manipulation (SQL/Python)
3
0

Analyze Returning Borrowers Across Two Days of Logs

You receive two collections of loan-activity records, one for each of two consecutive days. Each record contains user_id and loan_type; the same pair may appear multiple times.

Design a Python solution that:

  1. Returns the users who appear on both days and have at least two distinct loan types across the union of both days.
  2. Builds a per-user aggregate that can be passed to an interviewer-supplied trust_policy(aggregate) function without redesigning the first part.

The trust formula is deliberately not specified. Treat the policy as an injected pure function; do not invent its business rules. Explain your data structures, result ordering, complexity, and how you would test the aggregation boundary.

Clarifying Questions to Ask Guidance

  • Does “at least two loan types” apply to each day or to the two-day union?
  • Are duplicate records meaningful beyond presence?
  • What deterministic output order is required?
  • Which aggregate fields does the trust policy contract require?

What a Strong Answer Covers Guidance

  • Correct eligibility logic with explicit day-membership, distinctness, duplicate, and ordering semantics
  • A clear, extensible aggregate rather than coupling to an unknown score formula
  • Explicit duplicate and ordering semantics
  • Complexity proportional to the input plus output, with focused tests for boundary cases

Follow-up Questions Guidance

  1. How would the design change for a rolling 30-day window?
  2. How would you process logs that do not fit in memory?
  3. What if trust policies are versioned and old scores must be reproducible?
  4. Which checks prevent malformed records from silently changing eligibility?
Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Affirm•More Software Engineer•Affirm Software Engineer•Affirm Data Manipulation (SQL/Python)•Software Engineer Data Manipulation (SQL/Python)

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.