Avoided using list.count() due to O(n) complexity of the function and caused an actual complexity of polynomial. Reduced the order of growth to linear