npm install
npm test
node index.js input.txt
input.txt
file needs to be at the same directory of the index.js
file.Let's imagine that in the future this program needs to validate millions of possible phone numbers with the best possible performance. The presented solution processes one possible phone number at a time. Consequently, this will affect its performance.
To overcome such requirement, we would have to adapt this solution considering the Producer-Consumer paradigm. In this new solution, Producer(s)
are responsable for generate data, put it into the buffer/queue and start again. While, the Consumer(s)
is consuming the data (i.e, possible phone numbers), one piece at a time.
With this new solution, this program could process millions of possible phone numbers with increased performance.