Finding a random seed that solves a LeetCode problem (2023)
mcognetta.github.io
mcognetta.github.io
It was the first piece of code I put out that someone referred to as "art"[1].
Some others that hit the HN front page over the years:
https://news.ycombinator.com/item?id=10195358
https://news.ycombinator.com/item?id=9516824
https://news.ycombinator.com/item?id=26615938
I also had wrote some code for my former employer containing the magic string "haha jit go brrr" that raised some eyebrows when someone reverse engineering the code noticed it. It was part of a routine to try to coax the JIT into optimizing the code soon on low end Android devices for performance reasons, but someone who didn't understand what the code was doing thought it was part of an exploit... :facepalm:
`!("a" == "a"[0])` just detects IE6/7, as they return undefined for "a"[0]: https://unspecified.wordpress.com/2008/06/15/portable-javasc...
Here's the slide deck for a con talk I did a while back: https://rya.nc/files/A_nickel_tour_of_the_ad_fraud_ecosystem...
I haven't worked there for a couple of years though.
Only on HN does someone asks questions about an obscure cool thing and the original author enters the discussion. Thanks for the explanation.
:) the only extra bit of info there is that the seed was found by brute force over a few days
(and pray to the gods I don't somehow leave the instances running by mistake)
Here's a variant: "Given a list of k LeetCode problems sourced from a bag of n unique tricks, generate a new LeetCode problem that utilizes a trick not found in the bag."
I'm being facetious of course, but actually now I have an idea that we could create a bipartite graph mapping tricks to LeetCode problems. From there, given a willingness to memorize n tricks, we can compute the optimal bag of tricks to commit to memory in order to maximize the number of LeetCode problems quickly solvable during an interview, weighted by the probability of each problem's appearance.
Obviously Cantor was a genius, I would not expect most people, including myself, to come up with his argument themselves from scratch!
People expect genius in interviews all the time. They just don't realize that's what they're doing. They think what they're asking about is an obvious concept, forgetting that (insert renowned genius here) came up with the idea.
You are saying you took classes that covered logic, number theory, group theory, algorithmic complexity, discrete math, and calculus, and you are certain none of them covered this? Too bad, that is unfortunate! I'm glad you found it on your own! it's really neat!
https://chatgpt.com/share/baf1c785-11dc-46d1-aed7-860cbc741f...
One of the funniest things is when you find "strategy" that performs best over one year by making from 50 to 100 deals. But don't get fooled, it's just a random parameters, and when applied to the next year or years, you won't get these results, of course.
So you're getting reliable results only when you can reproduce your success (no matter what it is) consistently.
Eg we wouldn't be able to tell whether stock prices are truly random (according to some distribution), or governed by a cryptographically secure pseudo random number generator.
Another example: quantum mechanics is a fully deterministic theory. It's even linear, so we don't even get deterministic chaos like from Newtonian billiard balls or the Newtonian three body problem.
But some popular interpretations of quantum mechanics like the Copenhagen Interpretation decide that they need to add randomness to make sense of QM's predictions.
In contrast, some other interpretations like Many Worlds leave QM deterministic.
The author treats the seed as a hyperparameter and searches for the one that performs best for training a CV model.