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.
You don't need to get all the combinations to solve this problem, see the examples you will find a pattern there,Math.abs(a-b) is going to help you keep adding this to a you will get your result.
Note* I am assuming a is always less than or equal to b
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 →
You don't need to get all the combinations to solve this problem, see the examples you will find a pattern there,Math.abs(a-b) is going to help you keep adding this to a you will get your result.
Note* I am assuming a is always less than or equal to b