Array Manipulation Java Coding Challenge | HackerRank | How'd You Code That?

Опубликовано: 02 Август 2020
на канале: Ed Clark
3,877
272

Array Manipulation on HackerRank: https://www.hackerrank.com/challenges...

By the end of this video, you should have a good understanding of the prefix sum algorithm, the method we’ll use to solve this challenge.

The problem statement for this challenge reads:

Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array.

For example, the length of your array of zeros is 10 . Your list of queries is as follows:

The value “a” is the starting index in your array. The value ‘b’ is the ending index. The value ‘k’ is the integer to add to each element between the starting and ending indices of the array, inclusive. So, for the first query, indices 1 through 5 are incremented by 3, for a total of 3. The next query increments the values at the indices between 4 and 8 by 7, for a total of 10, at indices 4, and 5, and a total of 7 at indices 6 through 8. And the last query increments the values at the indices between 6 and 9 by 1, for a total of 8 at indices 6 through 8, and a total of 1 at index 9.

Once all operations have been performed, the largest value in the array is, 10.

Closed Captions/Subtitles - ed2clark@gmail.com

Video Editing - ed2clark@gmail.com

Song: Anywhere - Ikson (Vlog No Copyright Music)
Music promoted by Vlog No Copyright Music.
  / ikson  


На этой странице сайта вы можете посмотреть видео онлайн Array Manipulation Java Coding Challenge | HackerRank | How'd You Code That? длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Ed Clark 02 Август 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 3,877 раз и оно понравилось 272 зрителям. Приятного просмотра!