your teaching style is great ♥, I have another way with less conditions but the same time complexity const myMaxProfit = (prices) => { let maxProfit = 0; let minPrice =Math.min(...prices); let indexOfMin = prices.indexOf(minPrice); let maxPrice = 0; for (let i = indexOfMin + 1; i < prices.length; i++) { if (prices[i] > maxPrice) { maxPrice = prices[i]; } return maxProfit - minPrice; } }
@teabreak_ Жыл бұрын
where are you brother? @ThinkFWD please make more videos.Awesome content
@ChipyGamingVideos3 жыл бұрын
These videos are amazing! Thank you and keep it up
@chiho81193 жыл бұрын
Damn bro, if I discovered your videos earlier, then I would have a better resume. But nothing is too lol.