Hướng dẫn hackerrank hourglass solution python
Published Jun 17, 2021Last updated Mar 07, 2022 When I saw this question on Hackerrank, I wondered why it was under the easy difficulty level.
Well, upon research, I agree with the difficulty level. Constraints Explained
−9≤A[i][j]≤9-9 \le A[i][j] \le 9 Implies that each element is a single digit as it ranges between -9 and 9 inclusive Labelled ArrayLet's number the cells of our array A as follows: The HourglassesThe first hourglass from our numbered array A will be: [789141
92021]\begin{bmatrix}7&8&9\\ &14& \\19&20&21\end{bmatrix}, [8910
15202122]\begin{bmatrix}8&9&10\\ &15& \\20&21&22\end{bmatrix},
[9101116212223]\begin{bmatrix}9&10&11\\ &16& \\21&22&23\end{bmatrix}, [101112172
22324]\begin{bmatrix}10&11&12\\ &17& \\22&23&24\end{bmatrix},
Solution
In the above code, we import the
Please, let me know if there is a more efficient way to achieve the result; I'ld love to learn. Thanks to
Knowledge Center Enjoy this post? Give Olaide Alaka a like if it's helpful. 6Share Python/Django full-stack developer I am a full-stack developer versed in Python/Django with JavaScript, HTML, CSS, jQuery/Ajax. I have developed several web and desktop applications, including school management, quiz, school learning, eCommerce, and inventory appl... Discover and read more posts from Olaide Alaka Enjoy this post? Leave a like and comment for Olaide |