Points-in-a-plane from HackerRank
this is the problem of covering points with lines or linear facility location
which is NP-Hard. This is why you couldn't find a greedy solution. There are approximation and exact algorithms for this problem. If you want an exact algorithm that is efficient on large inputs I suggest you a simple version of parametrized solution for this problem.