Solutions for Word association game string question

    • @JavierVow
    • @jacob, submitted in JavaScript, achived 100% score
    function solve(s1, s2) {
        let a = new Set(s1);
        let b = new Set(s2);
    
        for (const letter of b) {
            if (a.has(letter)) {
                return "YES";
            }
        }
        return "NO";
    }
    • @JavierVow
    • @jacob, submitted in Python 2, achived 100% score
    # Complete the twoStrings function below.
    def solve(s1, s2):
    
        return 'YES' if set(s1) & set(s2) else 'NO'
    
    
    • @JavierVow
    • @jacob, submitted in Python 3, achived 100% score
    # Complete the twoStrings function below.
    def solve(s1, s2):
    
        return 'YES' if set(s1) & set(s2) else 'NO'