3 ms·
The mistake I often see in interviews: int cmp(int a, int b) { return a - b; } This can easily overflow or underflow. For example, if a = INT
by martincmartin 5y ago
The mistake I often see in interviews:
int cmp(int a, int b) {
return a - b;
}
This can easily overflow or underflow. For example, if a = INT_MAX and b < 0.
I don't count it against the person interviewing, because its common and arguably reasonable if your values are all < INT_MAX/2.