HackerRank The 2D Array DS Challenge using JavaScript

Опубликовано: 08 Июль 2020
на канале: Japheth Waruingi
2,574
36

https://www.hackerrank.com/challenges...
#js
#hackerRank
#loops
#Math module
Using the while loop to loop through the 16 iterations and pushing each sum to the sumArray variable i determined the maximum value in the array using the Math.max() spread operater to copy each value.
Question:-
Given a 6 x 6 2D Array
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
We define an hourglass in A to be a subset of values with indices falling in this pattern in arr's graphical representation:
a b c
d
e f g
There are 16 hourglasses in arr , and an hourglass sum is the sum of an hourglass' values. Calculate the hourglass sum for every hourglass in arr , then print the maximum hourglass sum.


На этой странице сайта вы можете посмотреть видео онлайн HackerRank The 2D Array DS Challenge using JavaScript длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Japheth Waruingi 08 Июль 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 2,574 раз и оно понравилось 36 зрителям. Приятного просмотра!