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.
Did not understand why my code passed only first 2 testcases and failed all the rest until I realized that the modulo code was not in the right place.
If you comment your modulo code and it passes the testcases below when n<12 but will fail as soon as n=12 , then your code is very close to the solution.
10 10 2
38742049
11 10 2
348678440
12 10 2
138105940
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Construct the Array
You are viewing a single comment's thread. Return to all comments →
Did not understand why my code passed only first 2 testcases and failed all the rest until I realized that the modulo code was not in the right place.
If you comment your modulo code and it passes the testcases below when n<12 but will fail as soon as n=12 , then your code is very close to the solution.
10 10 2 38742049
11 10 2 348678440
12 10 2 138105940