Substring search and weighted random sampling
Two problems for a machine learning engineer screen:
- Find where a pattern occurs in a text, and discuss doing better than checking every position.
- Pick an item at random with probability proportional to its weight.
No answer yet. Write the first one; the best answer gets endorsed.
