193. Valid Phone Numbers
UnknownView on LeetCode
Problem Overview
Valid Phone Numbers is a unknown-difficulty LeetCode problem. This is a common Shell pattern in coding interviews. Study the solution below and note the time and space complexity before attempting variations on your own.
A full step-by-step explanation is being added. See the study guide for pattern-based practice.
Read the solution code below and trace through it on paper before submitting. For structured interview prep, follow our 30-day study guide.
193.sh
Shell
# Read from the file file.txt and output all valid phone numbers to stdout.
grep -e "^[0-9]\{3\}\-[0-9]\{3\}\-[0-9]\{4\}$" -e "^([0-9]\{3\}) [0-9]\{3\}\-[0-9]\{4\}$" file.txtWas this solution helpful?