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

Publié le: 02 août 2020
sur la chaîne: 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  


Sur cette page du site, vous pouvez voir la vidéo en ligne Array Manipulation Java Coding Challenge | HackerRank | How'd You Code That? durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Ed Clark 02 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,877 fois et il a aimé 272 téléspectateurs. Bon visionnage!