Definition of `abs` is problem incorrect?


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;


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.