AlcoRhythm

AlcoRhythm 

Алгоритмы и Структуры данных

11subscribers

149posts

Showcase and bundles

3
A bundle is a collection, compilation, playlist, or catalog of posts that saves you from searching through the blog and lets you buy the entire content series in a single click.
goals1
$25.84 of $13 raised
На Балтику №(от 0 до 10) для видео :]

LeetCode - 122. Best Time to Buy and Sell Stock II

<<Назад | Программа курса | Далее>>
Задача для самостоятельной работы.
Не смотри видео ниже, пока не попробуешь сам.
Код на языке Swift
func maxProfit(_ prices: [Int]) -> Int {
    var profit = 0
    for i in 1..<prices.count {
        let diff = prices[i] - prices[i-1]
        if diff > 0 {
            profit += diff
        }
    }
    return profit
}
Subscription levels2

EasyPeasy / Проще некуда

$1.94 per month
Реквизит для "проще некуда"
Ищи по тегу easy-peasy

В РИТМЕ

$6.5 per month
Алгоритмы на практике:
- Поиск контактов в iPhone
- Задачи из списка Яндекс
Go up