We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static void Main(string[] args)
{
string a = Console.ReadLine();
string b = Console.ReadLine();
int LenA = a.Length;
int LenB = b.Length;
List<char> ListA = new List<char>(LenA);
List<char> ListB = new List<char>(LenB);
ListA = a.ToList();
ListB = b.ToList();
int total = LenA + LenB;
int count = 0;
for (int i = 0; i < LenA; i++)
{
if (ListB.Contains(ListA[i]))
{
count++;
ListB.Remove(ListA[i]);
}
}
Console.WriteLine(total - (2*count));
}
Let me know if i can improve it. Thanks.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
My C# code: Same Logic Different Implementation.
Let me know if i can improve it. Thanks.