Ad
Code
Diff
  • using System.Collections.Generic;
    using System.Linq;
    public class Kata
    {
        /// <summary>
        /// Checks if two char arrays contain at least one common item.
        /// </summary>
        /// <param name="a">First char array</param>
        /// <param name="b">Second char array</param>
        /// <returns>True if the arrays have at least one common item, false otherwise</returns>
    public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();    
    
    
    • using System.Collections.Generic;
    • using System.Linq;
    • public class Kata
    • {
    • /// <summary>
    • /// Checks if two char arrays contain at least one common item.
    • /// </summary>
    • /// <param name="a">First char array</param>
    • /// <param name="b">Second char array</param>
    • /// <returns>True if the arrays have at least one common item, false otherwise</returns>
    • public static bool ContainsCommonItem(char[] a, char[] b)
    • {
    • // If either input array is null, return false
    • if (a == null || b == null) return false;
    • public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();
    • return a.Intersect(b).Any();
    • }
    • }