You are viewing a single comment's thread. Return to all comments →
I don't particularly know what test case 8 is exactly, but I would assume that this test case has set the input parameters of n and d to be very large. If you look at the constraints on n, then you will see that n can be as large as 10,000 and d also can be as large as n. With an approach that manually shifts the array one by one a certain amount of times can lead to a lot of work. Possibly shifting all 10,000 elements to the left 10,000 times racks up to a lot of work. You would have to shift something up to 10,000,000,000 times in this scenario. That is a lot of work and would most likely be the reason the test case times out before finishing.