bool isMAC48Address(string inputString) { return Regex.IsMatch(inputString, "^([0-9A-F]{2}-){5}[0-9A-F]{2}$"); }
Previous Next
bool isMAC48Address(string inputString) { return Regex.IsMatch(inputString, "^([0-9A-F]{2}-){5}[0-9A-F]{2}$"); }
int electionsWinners(int[] votes, int k) { var max = votes.Max(); return k == 0 && votes.Where(d => d == votes.Max()).Count() == 1 ? 1 : votes.Count(t => t + k > max); }
string buildPalindrome(string st) { var i = 0; while (!st.Substring(i).ToArray().SequenceEqual(st.Substring(i).Reverse().ToArray()) && i < st.Length) i++; return st + new string(st.Substring(0, i).Reverse().ToArray()); }
string findEmailDomain(string address) { return Regex.Match(address, "@[A-z0-9\\.-]+$").Value.Substring(1); }
bool isBeautifulString(string inputString) { var sorted = Enumerable.Range('a', inputString.Max(c => c) - 'a' + 1).Select(i => (char)i).ToArray(); for (var i = 1; i < sorted.Length; i++) if (inputString.Count(c => c == sorted[i]) > inputString.Count(c => c == sorted[i - 1])) return false; return true; }