3 ms·
And it is. The question is: f(f(n)) == -n Where n is a 32 bit signed integer It's `f(n)` that is not a signed integer. Both `n` and `f(f(n))` are ints
by viraptor 13y ago
And it is. The question is:
f(f(n)) == -n
Where n is a 32 bit signed integer
It's `f(n)` that is not a signed integer. Both `n` and `f(f(n))` are ints, so the answer is within the constraints. There's nothing said about the signature of the function.
- bsaul 13y agothat seems a bit far fetched. the way i understand n, it means " f input ", as "the parameter that f takes as input, whose type is an integer". Anyway, that's probably just one way of reading the question. Really depends on what the interviewer's intention was.
- petercooper 13y agoTherein lies a lesson for the interviewer, "your spec is too vague" :-)