Daily challenge for 2026-04-27
482. Maximum Profit with Single Skip
You are given an array of integers prices representing the daily price of a stock. You want to maximize your profit by choosing a single day to buy and a single day to sell. However, you have a special ability: you can skip exactly one day's price in the middle of your holding period (between the buy day and the sell day) to effectively 'bridge' a price dip. If you choose to skip a day, the profit is calculated as the sell price minus the buy price, but you must have held the stock for at least 2 days (buy on day i, skip day j, sell on day k, where i < j < k). If you don't skip, it's a standard buy-sell. Return the maximum profit possible. If no profit can be made, return 0.
Example:Input: prices = [10, 2, 5, 1, 8]Output: 7
(Buy at 1, sell at 8. Skipping is not required to reach 7, but the logic allows it.)