Deviopath › Go

Absolute Value

Easy · Numbers

The absolute value of n is n when n >= 0 and -n otherwise. Go has int overflow for math.MinInt, but the tests stay in a safe range.

Write Abs(n) that returns the absolute value of n.

Next: Last Element