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.
Its a little late but essentially when you do
(long long) ( a * b * c)
if a,b and c are integers and an overflow has already occured then casting it to a long long wont help. It will compile but the overflow has already happened. You need
(long long)a * (long long)b * (long long)c
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 →
Its a little late but essentially when you do (long long) ( a * b * c) if a,b and c are integers and an overflow has already occured then casting it to a long long wont help. It will compile but the overflow has already happened. You need
(long long)a * (long long)b * (long long)c