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 - [email protected]
Video Editing - [email protected]
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, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,550 раз и оно понравилось 275 людям.