tried doing greedy alg