Русские видео

Сейчас в тренде

Иностранные видео




Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Flip

Timestamps: 0:00 Reading the problem 2:30 Explaining intuition 3:30 Kadane Algorithm 6:00 Kadane Code and Dry Run 10:30 Example dry run 13:02 Code CPP Input Format First and only argument is a string A. Output Format Return an array of integers denoting the answer. Example Input Input 1: A = "010" Input 2: A = "111" Example Output Output 1: [1, 1] Output 2: [] Example Explanation Explanation 1: A = "010" Pair of [L, R] | Final string ___________|_________ [1 1] | "110" [1 2] | "100" [1 3] | "101" [2 2] | "000" [2 3] | "001" We see that two pairs [1, 1] and [1, 3] give same number of 1s in final string. So, we return [1, 1]. Explanation 2: No operation can give us more than three 1s in final string. So, we return empty array [].

Comments