Solution2 for passingcars - codility