Get the latest tech news

Finding a random seed that solves a LeetCode problem (2023)


A side hobby of mine is solving LeetCode questions in unintended ways – most often via convoluted one-liners. Such a style of self-imposed constraints make the questions more fun and forces me to think outside of the box for solutions, invoking the feeling of "necessity is the mother of invention".

Such a style of self-imposed constraints make the questions more fun and forces me to think outside of the box for solutions, invoking the feeling of "necessity is the mother of invention". As kkk gets larger, even including a large number of test cases doesn't significantly reduce the probability of randomly succeeding in all trials. This understanding of the likelihood of randomly solving large test sets is what gave me confidence that an appropriate seed could be found in a reasonable amount of time.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Leetcode

Leetcode

Photo of random seed

random seed

Photo of LeetCode problem

LeetCode problem

Related news:

News photo

ML Code Exercises