I think the trick you’re going for (and I agree with others that these are mostly tricks—fun for conversation, interesting puzzles among friends, but fairly poor for interviews) requires a further restriction than an arbitrary array of Java primitive ints.
This is too close to an answer, so I’ll further obscure it. I used rot-221 for extra secrecy!
V guvax gurl arrq gb or pbagvthbhf, fhpu gung gur enatr vf gur fnzr nf gur neenl fvmr. Gurer vf ab fbeg orggre guna B(AybtA) gung arrqf gb pbzcner ryrzragf gb rnpu bgure.
I share the general sentiment that these are tricks and unsuitable for interviews, but lsusr’s answer is correct and does not require additional constraints.
There is no such algorithm.
… then your answer is wrong. So… what gives?
This question isn’t about integers “given no assumptions”. It’s about the
int
primitive in Java.Nevermind.
I think the trick you’re going for (and I agree with others that these are mostly tricks—fun for conversation, interesting puzzles among friends, but fairly poor for interviews) requires a further restriction than an arbitrary array of Java primitive ints.
This is too close to an answer, so I’ll further obscure it. I used rot-221 for extra secrecy!
V guvax gurl arrq gb or pbagvthbhf, fhpu gung gur enatr vf gur fnzr nf gur neenl fvmr. Gurer vf ab fbeg orggre guna B(AybtA) gung arrqf gb pbzcner ryrzragf gb rnpu bgure.
I share the general sentiment that these are tricks and unsuitable for interviews, but lsusr’s answer is correct and does not require additional constraints.