Solution 3 worst case cost