My solution written only in Bash


  • 0
    C
    array=()
    
    while read -a columns; do
        for (( i = 0; i < ${#columns[@]}; i++ )); do
            array[i]="${array[i]} ${columns[i]}"
        done
    done < file.txt
    
    for (( i = 0; i < ${#array[@]}; i++ )); do
        echo ${array[i]}
    done
    

    Taught by @yongjhih


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.