using System.Collections.Generic;
public static void Main()
var intArray = new int[] { 1, 4, 5, 67, 3, 16, 98, 4, 3, 3, 2147483647 };
var intList = new List<int> { 1, 4, 5, 67, 3, 16, 98, 4, 3, 3, 2147483647 };
var strArray1 = new string[] { "jon doe", "marrty mcfly", "cher", null, "sir issac newton" };
var strList1 = new List<string> { "jon doe", "marrty mcfly", "cher", null, "sir issac newton" };
var strArray2 = new string[] { "hello", "world", "zoom", null, "mmm", "Collectiiion" };
var strList2 = new List<string> { "hello", "world", "zoom", null, "mmm", "Collectiiion" };
var strArray3 = new string[] { "a", "b", "c", "d", "e", "f" };
var strList3 = new List<string> { "a", "b", "b", "d", "d", "c", "a", "d", "f" };
Console.WriteLine("====================START=========================");
CountDeplucates(intArray);
CountFrequency(intArray);
DeleteRepeating(strList2);
FindOccurence(strArray3, strList3);
Console.WriteLine("====================FINISH=======================");
public static void Reverse(IEnumerable<int> items)
Console.Write("Reverse: ");
items.ToList().ForEach(item => Console.Write(item + ","));
public static void Sum(IEnumerable<int> items)
var sum = items.Sum(item => (float) item);
Console.WriteLine("Sum: " + sum);
public static void CountDeplucates(IEnumerable<int> items)
var tracker = new Dictionary<int, int>();
items.ToList().ForEach(item =>
if (tracker.ContainsKey(item))
var count = tracker.Where(record => record.Value > 0).Count();
Console.WriteLine("Duplicates: " + count);
public static void CountFrequency(IEnumerable<int> items)
var tracker = new Dictionary<int, int>();
items.ToList().ForEach(item =>
if (tracker.ContainsKey(item))
tracker.ToList().ForEach(record =>
Console.WriteLine(record.Key + ": " + record.Value);
public static void Capitalize(IEnumerable<string> items)
items.ToList().ForEach(name => {
var builder = new StringBuilder(name);
name.Split(' ').ToList().ForEach(word => {
var newWord = char.ToUpper(word[0]) + word.Substring(1);
builder.Replace(word, newWord);
Console.WriteLine(builder.ToString());
public static void UniqueLetter(IEnumerable<string> items)
items.ToList().ForEach(name => {
while (name != null && unique && index < name.Length)
var count = name.Count(c => c == name[index]);
Console.WriteLine(name + ": " + unique);
public static void DeleteRepeating(IEnumerable<string> items)
items.ToList().ForEach(name =>
var builder = new StringBuilder(name);
for(var i = 0; i < builder.Length; i++)
if(i < builder.Length - 1 && builder[i] == builder[i + 1])
while (i < builder.Length - 1 && builder[i] == builder[i + 1])
builder.Remove(i + 1, 1);
Console.WriteLine(builder.ToString());
public static void FindOccurence(IEnumerable<string> strList1, IEnumerable<string> strList2)
strList1.ToList().ForEach(str => {
var count = strList2.Count(str2 => str == str2);
Console.WriteLine(str + ": " + count);