Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
585 B
0
Indexable
Never
function Solution(S){
    const N = S.length;
    const M = S[0].length;
    let result = new Array(); 
    let found = false;

  
    if (S.length === 0){
        result =[];
    };

    for (let i =0; i < N; i++){
        for (let j = i + 1; j <N; j++){
            for(let k =0; k < M; k++){
                if (S[i][k] === S[j][k]){
                    result = [i, j, k];
                    found = true;
                    break;
                }
            }
            if(found) break;
        }
        if(found) break;
    }
    return result;
}
Leave a Comment