Shouldn't absolute difference always be a positive number?

  • 0

    Absolute difference by definition is a positive number. The test cases with negative values of k just contradicts that.

    It would be great if the problem is phrased better to avoid this confusion!

  • 0

    There's no problem. For negative k, the result simply is zero.

Log in to reply

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