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.
It returns the correct answers, but times out on half of the tests.
I did not consider that I could form an array with empty entries and populate it with the additive value at start/stop indices. That sped the processing time up enough to pass the timing tests. I ended up studying your solution the producing the same thing after understanding how it works. Thanks!
With HackerRank solutions there is often an easy-to-read stepped solution that will pass tests with correct answers, but fail on timeouts with large numbers or sets of data. To avoid timeouts it is necessary to author solutions that are more considerate of data regardless of how easy-to-read.
`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
My original solution was:
It returns the correct answers, but times out on half of the tests.
I did not consider that I could form an array with empty entries and populate it with the additive value at start/stop indices. That sped the processing time up enough to pass the timing tests. I ended up studying your solution the producing the same thing after understanding how it works. Thanks!
With HackerRank solutions there is often an easy-to-read stepped solution that will pass tests with correct answers, but fail on timeouts with large numbers or sets of data. To avoid timeouts it is necessary to author solutions that are more considerate of data regardless of how easy-to-read.
`