Definition of `abs` is problem incorrect?


#1

problem statement says abs deinition as follows but solution does not follow this. Is the definition of abs is incorrect?

*abs(x) is absolute value of x and is implemented in the following manner : **

      if (x < 0) return -x;
      else return x;

#2

It is correct because let us suppose x=-3 then abs(x)=3 which mean it is -(-3) so eventually it becomes positive and if x=3 it remains as 3 .I hope your doubt is cleared.