Custom Testcase Code Bug

  • 0

    The code that generates the expected answer doesn't like large numbers.

    I was testing this using "PAYPALISHIRING" as the input string, and large numbers as the numRows.

    For numbers 2147483642 through 2147483647 the expected answer is always "". This is wrong. It should be "PAYPALISHIRING".

    For numbers 1073741826 through 2147483641 the expected answer is "Line 15: java.lang.StringIndexOutOfBoundsException: String index out of range: $NUM", where $NUM is from -2147483647 to -1.

    For numbers some numbers under 1073741825 it doesn't give any output at all! Not even "".

    It doesn't make a difference for the result, any number larger than the string you give it just returns the string. But it makes me curious how these bugs happen.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.