+ 1
Can anyone suggest me a way to print duplicate values in an array?
And also it should print the duplicate value and the count of that number
3 Respostas
+ 5
Kalindu Wanasinghe , please show us your attempt first. If you have not done a try by yourself upto now, please do so. put your code in playground and link it here. Thanks
+ 2
Using std::map is one possible way
https://en.cppreference.com/w/cpp/container/map
+ 2
Use "count" from the <algorithm> hearer file, and if the count is more than 1, just output it. might be better to put the array into a set then do a simple "for in" loop but use "count" with the original array.