Checkout my solution here

  • 1
    #if file.txt does not contain enough lines, we just pad it with 10 empty lines.
    echo "
    " | cat file.txt - | head | tail -n 1

    I thought it simple enough for this question.

Log in to reply

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