N checkpoint problem.

Revision en1, by atlasworld, 2019-02-24 00:06:40

You are given n checkpoints in (x , y) plane . you have to choose any two pairs i , j (j can be = i ) such that (xj-xi) + (yj-yi) = k

How to solve it in O(n) time .

N = 1e5 .

xi, yi = -1e9 , 1e9

Any idea.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English atlasworld 2019-02-24 00:10:18 8
en2 English atlasworld 2019-02-24 00:09:49 174
en1 English atlasworld 2019-02-24 00:06:40 238 Initial revision (published)