I'm going to be funemployed real soonish and currently searching for a new job. This is what they want a prospective employee to solve and optimize the solution:
1. Given an array of points on a surface (defined by their Cartesian coordinates -- "for the sake of simplicity, the coordinates are integer numbers" -- this is verbatim), for each point, find the point closest to it and all points within double distance to the closest point.
I solved #2. It has fuck all to do with substring search.2. Find the earliest appearance of a given sequence of digits in the sequence 1234567891011121314151617181920212223...
What's a fast way to do #1? (The only improvement over the dumbest possible solution I can imagine is not using the square root.)