Mid From PDF Coding Scenarios C# Coding Interview

Find all duplicate characters in a string?

string input = "programming";
Dictionary<char, int> map = new Dictionary<char, int>();
foreach (char c in input)
map[c] = map.ContainsKey(c) ? map[c] + 1 : 1;
foreach (var item in map)
{
if (item.Value > 1)

Console.WriteLine(item.Key);

}

More from C# Programming Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details