The problem states that we receive an array of tuples, where each tuple represents a point, and we need to return the maximum number of colinear points.
I have already found a O(N^2) solution by comparing each point with every other one possible based on the same slope stored in a hash table.
I believe to have found a O(N) solution by considering each point as a vector.
If I compute the norm of each vector, and obtained the corresponding normalised vector, then if two normalised vectors are the same, it means that their correspondings heads point to colinear points. Is this correct?
If so I could build a hash table, traverse evey point once, storing the normalised vectors and whenever I found a repeated one it means I have another co-linear point to the point in question.
Thanks!
Marco