Maximize profit from one stock trade
Company: Two Sigma
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: nan
Interview Round: Technical Screen
Quick Answer: This question evaluates algorithmic problem-solving skills with emphasis on array processing, numeric optimization, and time/space complexity analysis in the coding & algorithms domain. It is commonly asked to assess practical implementation ability and efficiency trade-offs under input-size constraints, and the level of abstraction is practical application rather than purely conceptual reasoning.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([7,1,5,3,6,4],)
Expected Output: 5
Explanation: Prompt example.
Input: ([7,6,4,3,1],)
Expected Output: 0
Explanation: No profit.
Input: ([1],)
Expected Output: 0
Explanation: Single day.
Hints
- Use deterministic tie-breaking for prompts with multiple valid outputs.
- For design-style APIs, simulate operations with explicit inputs.