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.
instead of if(x>=-32768 && x<=32768)
try if(x >= -32768 && x <= 32767)
I think it's because 0 counts and a bit so the range ends at 32767 instead of 32768
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
instead of if(x>=-32768 && x<=32768) try if(x >= -32768 && x <= 32767) I think it's because 0 counts and a bit so the range ends at 32767 instead of 32768