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.
Hints: Make sure your types are long, not int, because even if the value of costs are up to 10^9, when multiplied with the number of cuts they overflow. Obviously the result needs to be long as well, BUT make sure you display it modulo 1000000007 (for whatever weird reason, it is part of the problem text)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cutting Boards
You are viewing a single comment's thread. Return to all comments →
Hints: Make sure your types are long, not int, because even if the value of costs are up to 10^9, when multiplied with the number of cuts they overflow. Obviously the result needs to be long as well, BUT make sure you display it modulo 1000000007 (for whatever weird reason, it is part of the problem text)