Say you have a function rand(1,3) that returns a random number 1, 2, or 3 and it does a good job and returns each number with a 1/3 probability.
Now lets say for some reason you only need the numbers 0 or 1.
I thought of this today and then my mind was blown when it worked.
Say you want to do some asynchronous stuff in a particular order and wait for each completion before proceeding. It can easily be done with generators and…
Here’s a question I was asked in a job interview:
“Given a million X, Y coordinates how would you find the nearest 100 points?”