DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Trade Signal

A easy Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.

Domain
Python
Difficulty
easy
Seniority
L4

Interview Prompt

Given a list of prices indexed by day, find the maximum gain from a single buy-then-sell window where you must buy before you sell. Return a 3-element list [gain, buy_day_index, sell_day_index], where buy_day_index and sell_day_index are the positions in the input list. If no profitable trade is possible (gain <= 0, including a flat or strictly declining series), return [0, -1, -1] to signal no trade. Among multiple windows tied for max gain, return the one with the earliest buy index, then earliest sell index.

Summary

Buy low, sell high. Identify the ideal moment.

How This Interview Works

  1. Read the vague prompt (just like a real interview)
  2. Ask clarifying questions to the AI interviewer
  3. Write your python solution with real code execution
  4. Get instant feedback and a hire/no-hire decision

Related

  • All Mock Interviews
  • Practice Mode (untimed)
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Practice Problems
  • Daily Challenge