Quick Overview

Implement one stock-profit interface for limited transactions, unlimited transactions, and per-sale fees. Model cash and holding states, handle zero or negative-value edge cases, and optimize the finite-cap dynamic program when the transaction limit cannot bind.

Unify Stock-Trading Profit Variants

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Overview: Implement one stock-profit interface for limited transactions, unlimited transactions, and per-sale fees. Model cash and holding states, handle zero or negative-value edge cases, and optimize the finite-cap dynamic program when the transaction limit cannot bind.

Loading…