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 use BigInteger, the maximum value for this challenge according to the constraints is 1,00E+18 while a long can hold a number up to 9,22E+18, more than nine times of what you need. Note that an int will only give the correct answer for sums that don't go over 231-1.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Filling Jars
You are viewing a single comment's thread. Return to all comments →
You don't need to use BigInteger, the maximum value for this challenge according to the constraints is 1,00E+18 while a long can hold a number up to 9,22E+18, more than nine times of what you need.
Note that an int will only give the correct answer for sums that don't go over 231-1.