What is wrong with my solution?


  • 0
    O

    The test seems to be too picky about newlines!

    gname=()
    gage=()
    while read name age; do
        gname+=( $name )
        gage+=( $age )
    done < file.txt
    
    echo "${gname[@]}"
    #echo "${gage[@]}"
    [[ -n $gage ]] && echo "${gage[@]}" #fix first test
    

Log in to reply
 

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