Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, suppose I have an array `A' of size `len'. How would you write an algorithm that reverses that array in place, without using any temporary variables, and that works for arbitrary values of A and len? I think the answer is "you can't". You can't claim to have a solution for the problem if it only works for a fixed input, and if the solution itself would be different for different inputs.


> I think the answer is "you can't".

That's what I said a few posts ago.

> You can't claim to have a solution for the problem if it only works for a

> fixed input, and if the solution itself would be different for different

> inputs.

"Reverse this array". Done. "Reverse an unspecified array of arbitrary length" is a different problem :)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: