1 vote

Find 1s in almost all 0 array using comparisons only

Start by splitting the 100 elements in 50 pairs of two, and use a comparison on each pair. If a comparison returns -1 or 1, then you've found one of the elements which is 1 (and the other one must be ...
orlp's user avatar
  • 13k
1 vote

Algorithm that finds points that are closest to the middle of rectangles in grid

The naive approach is the following two steps: For each point, insert it into its respective box in $O(n)$. For each box, iterate every point in it to keep track of the minimum distance to the ...
Kenneth Kho's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible