greedy algo tested