You are viewing a single comment's thread. Return to all comments →
In your solution Math.pow(2,63) is actually going to return an Int, it will return the largest int it can be calculated (2^31)-1. You have to specifically point out which numbers are going to be considered longs by appending an L at the end of the number (Like this: 600851475143L). This is because in java long literals end with an L. Source
I have almost the same solution as you, with the exception that I have every max and min dataType value stored in a different variable (like minInt, maxInt, minShort and so on).
Even though, I cant get it right on the test scenarios once the solution is submitted. Its quite frustrating.