Smallest possible solution c++


#1

int Solution::solve(int N ) {
N = abs(N);
int i = 1 ;
int s = 0 ;
while( s< N || (s-N) % 2 != 0 )s+=i++ ;
return i-1 ;
}