Hacker News new | ask | show | jobs
by Stratoscope 999 days ago
I have seen lines of code projected vividly like this.

Several years ago a Facebook recruiter invited me to interview with them. It mostly went well, except I bombed the leetcode algorithm quiz.

The next day, as I expected, they sent me a polite note thanking me for interviewing but they would be moving on with other candidates.

The morning after that, I woke up and before I opened my eyes I saw the complete solution on the back of my eyelids, about 20 lines of code.

I stepped through the code mentally and thought, "Yes! This will work!"

So I ran to my computer and typed the code in to test it. Other than one bug - this was old-school JavaScript and I'd forgotten one var statement, so there was an inadvertent global - it worked perfectly.

3 comments

If you’re not already aware, there is also a phenomenon where a person wakes up with a solution to something they had a problem with. Sleep is required for memory formation and organization, during which new and sometimes novel associations can be made.

I personally consider naps an essential part of studying because of this.

I have, in more than one occasion, gone to sleep with a problem in mind and woke up with a solution, but it is more of a conceptual thing. To actually see the lines of code, if true, is wild.
The story is indeed true, in every detail. And yes, it was a wild experience.

I'd never had this happen before, nor since. I wish it were a skill I could develop and cultivate!

This is just common solving problems while you sleep. Everyone does this. If you're having trouble with something - try a nap.
I think you missed the point.
Which point? That there were so many lines of code imagined exactly? It's a continuous scale. 20 lines seems very good, but not exceptional.
I must. It doesn't sound like anything special.