Easy Peasy C++ All test case passed


#1
int Solution::solve(int n) 
{
    int ans = 0, sum = 0; n = abs(n);
    while(sum < n || (sum - n) % 2) ans++, sum += ans;
    return ans;
}

#2

thanks bro,this was helpful