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

It's not hard to prove that that's impossible


It's possible if RAM isn't a constraint, using a bitset of all possible five-letter strings. The bitset would take up 4G of RAM (128G for extended ASCII, more for unicode).

In practice, that would actually be slower on this input, because of the cost of initializing the bitset. But that is not dependent on the input, so computational complexity is unaffected.

edit: Removed description. Yes, you're right, you can't even look at the whole input in constant time.


This is a misunderstanding, you must have answered to my reply after ithayer edited his comment, the initial comment said "constant time".


Didn't understand what you meant, care to elaborate?


:) I meant linear, but I'd review a proof :)




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: