Why is expression evaluation truncated to int?

  • 0

    I solved this first using doubles, and then kept debugging to see why I got wrong answers. I know the problem states inputs are integers, but why is everyone assuming division should be truncated to int as well?

  • 0

    Operation on operands returns result same type of operands.
    So integer division returns integer result.

Log in to reply

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