This is indeed in their hint. The problem is, for their swift function signature, it returns Int. On their machine that evaluates the code, Int is actually 64 bit, which means it won't overflow! You'll need to use Int32.max and Int32.min to check for overflow.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.