You are viewing a single comment's thread. Return to all comments →
My solution in C#, 100% pass.
static int anagram(string s) { if (s.Length % 2 != 0) return -1; string a = s.Substring(0, s.Length / 2); string b = s.Substring(s.Length / 2); foreach(char c in b) { if (a.IndexOf(c) > -1) a = a.Remove(a.IndexOf(c), 1); } return a.Length; }
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →
My solution in C#, 100% pass.