3 ms·
It's a shitty question. it's not O(1) in space cause it's using bits of the numbers on the stack to store extra information. The operations will overflow if it'
by d--b 5y ago
It's a shitty question. it's not O(1) in space cause it's using bits of the numbers on the stack to store extra information. The operations will overflow if it's filled with large enough numbers.
This is not a brain teaser, this is a question you know the answer of or you don't. Nobody can come up with a crappy algorithm like this on the spot, especially in an interview setting. I hope your interviewer is reading this.