DataDrivenDataDriven
LearnPracticeInterviewDiscussDailyJobs

The Complement Hunt

A easy Python interview practice problem on DataDriven. Write and execute real python code with instant feedback.

Domain
Python
Difficulty
easy
Seniority
L4

Problem

A fraud monitor ingests a stream of transaction `amounts` in arrival order, watching for two that were split to reach a flagged `target`. As each amount arrives, report the position of the earliest earlier amount that pairs with it to reach the target, or `-1` if no earlier amount does.

Summary

Every number is looking for its other half.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and checks it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons