This is a verified interview question from Bny. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Get Max Profit" covers key patterns like DP.
"You want to maximize the profit from a trading portfolio while taking a minimum number of losses. Given: - An array pnl of n integers representing monthly profits/losses (negative values are losses) - An integer k representing the minimum number of losses that must be taken The traders can: - Add any positive profit to their profit - For negative pnl, either subtract it or skip it - The net profit must always be non-negative Find the maximum total profit that can be earned after taking at least K losses. Return -1 if it is not possible to take k losses."
Join thousands of developers practicing for Bny.