Are C++ tests correct?


  • 0
    A

    I can't submit my C++ solution because the tests report:

    Input:
    -2147483648
    -1
    Output:
    -2147483648
    Expected:
    2147483647

    If I write normal C++ code like this:
    int rxxx = numeric_limits<int>::min() / -1;

    I have this result:
    rxxx = -2147483648

    I kind of understand why the tests expect what they expect for this combination but that expectation does not correlate with the original divide operator.


Log in to reply
 

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