Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
585 B
1
Indexable
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