/** * @param {number[]} prices * @return {number} */ function maxProfit(prices) { // TODO: find the maximum profit from a single buy/sell return 0; } console.log(maxProfit([7, 1, 5, 3, 6, 4])); // 5 console.log(maxProfit([7, 6, 4, 3, 1])); // 0
Click Run to execute, or Submit to grade (all languages).