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.
I started with the same approach, but there is a gotcha in there.
[1,2,3,4].slice(2,6) will return [3,4]. So the length of a new array is only 2. Have no idea how to fix it so I decided to use the inner cycle.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
I started with the same approach, but there is a gotcha in there. [1,2,3,4].slice(2,6) will return [3,4]. So the length of a new array is only 2. Have no idea how to fix it so I decided to use the inner cycle.