Taxis Solution O(n)