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.
The solution here is to use the absolute difference between the two differences to increment the initial value (0 + (smallest_value_between_a_and_b * (n-1))) until you reach the expected number of stones (initial value is the first stone).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Manasa and Stones
You are viewing a single comment's thread. Return to all comments →
My solution in C language :
The solution here is to use the absolute difference between the two differences to increment the initial value (0 + (smallest_value_between_a_and_b * (n-1))) until you reach the expected number of stones (initial value is the first stone).