0

I have an array of integers A = [1,2,3,4,100,100,1,-1]. I want to find the number of times each element appears in the array.
My Thoughts:
One way could be storing it like [1,2]. Then, the first element in the array represents the element, and the second represents the count of the element. But updating it won't be easy. Any thoughts on how can we approach this problem?

daniel
  • 169
  • 9

0 Answers0