We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
if there is a square matrix of size n then all we can do is to traverse half way in it but first we will see if N is odd or even and n should be more than 3 (for hour glass formation).
like if its 6
then traverse the i th and j th elements by running a loop till 3.
if n= odd number ,like 9 then
(n+1)/2= 5 traverse the i th and j th elements by running a loop till 5.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
if there is a square matrix of size n then all we can do is to traverse half way in it but first we will see if N is odd or even and n should be more than 3 (for hour glass formation). like if its 6 then traverse the i th and j th elements by running a loop till 3. if n= odd number ,like 9 then (n+1)/2= 5 traverse the i th and j th elements by running a loop till 5.