How to find the count of each element in an array that is duplicated?
for eg:
array[]1={1,2,1,1,2,3,4,5,1,1}
here we should not use loops .to ain iterate again
o/p:
1 =5
2= 2
3=1
so on
How to find the count of each element in an array that is duplicated and print that value in output?
1 Like
Sandeep, simplest way would be using a LINQ query.
dict = (From item In intArray
Group item By value= item Into GroupResult=Group
Select GroupResult).ToDictionary(Function(x) CInt(x(0)), Function(y) CInt(y.Count))
Where dict => Dictionary(of Int32, Int32); intArray = Integer Array ( {1,2,1,1,2,3,4,5,1,1})
1 Like
@Dominic Can you please send an example of how to do that?