doesn't show repeated elements, since 3 appears only once.1:2, 2:2, 3:1
That isn't an explanation of what you want, simply an example. From which it appears you are trying to count values, not seek repeats.Alex Moradi wrote:Look, . . . What change my code needs to get that output?
It's good to be able to use someting, it's better to understand how it works.
www.goanation.net
It's good to be able to use someting, it's better to understand how it works.
www.goanation.net
It's good to be able to use someting, it's better to understand how it works.
www.goanation.net
It's good to be able to use someting, it's better to understand how it works.
www.goanation.net
-Mannu
That means, 3 appears 3×. I am afraid I am going into pedantic mode. You don't have a set there, beause sets don't contain duplicates; as a set, that would read {1, 2, 3}. What you are doing is counting elements equal to each other and only printing which are repeated.Alex Moradi wrote:. . . Number 1 repeated 3 times and ignor numbers that not repeated in the set! . . .
| With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |