I see many people forgetting about multiplication symbol.
Two common mistakes.
a *= -1;
a = -a;
res = res * symbol;
res = (symbol == -1)? res = -res: res;
or (make symbol into boolean)
res = (neg)? res = -res: res;
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.