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.
None of l, b and h are out of bounds. They all are <= 105 which will fit inside an int (109.3) (you can download the testcase to make sure of it). But volume will be equal to the product of those three, and in the most extreme case, it's gonna be equal to 105x105x105=1015 which doesn't fit into an int, so you have to use a long int (1018.9). Hope this helps you.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Box It!
You are viewing a single comment's thread. Return to all comments →
None of
l
,b
andh
are out of bounds. They all are <= 105 which will fit inside anint
(109.3) (you can download the testcase to make sure of it). Butvolume
will be equal to the product of those three, and in the most extreme case, it's gonna be equal to 105x105x105=1015 which doesn't fit into anint
, so you have to use along int
(1018.9). Hope this helps you.