Ad
  • Custom User Avatar

    This solution has a run time of O(n). Since the run time of a sorting algorithm is usually O(nlogn), and you'd still have to iterate through your array once more to count the number of times the integer appears, this solution would be faster.