Loading...

The Trade Signal

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

Domain
Python
Difficulty
easy
Seniority
mid

Problem

The analytics team tracks a metric that fluctuates daily and wants to find the single best window where a buy-low-sell-high strategy would have yielded maximum gain. They need the gain amount and the exact day indices. Write a function that scans a list of daily values and returns the maximum possible profit from one buy and one later sell, along with the buy and sell indices.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.