Given a string of text with phone numbers in it, return a unique'd cell array of strings that are the area codes.
s = '508-647-7000, (508) 647-7001, 617-555-1212';
then
a = {'508','617'}
Note: This problem refers to American-style phone numbers. You can assume the first three digits of a ten-digit number will always be the area code.
An explanation of common notations of area codes would be nice for us non-Americans :)
I (as French) Agree. A Wikipedia link which would explain supported area codes is definitely missing.
"You can assume the first three digits of a ten-digit number will always be the area code." Hmmm.... too bad there was no explanation applying to telephone numbers with more (or less?) than ten digits.
Apparently the order needs to be the same as that defined by the test suite; which is not in the order of the phone numbers given :(
Is there a way to execute regexp/regexprep with multiple expresssions at the same time?
regexp hack
Not sure what's going on here, but it works in my actual MATLAB program, and Octave.
263 Solvers
360 Solvers
Generate a vector like 1,2,2,3,3,3,4,4,4,4
1569 Solvers
The sum of the numbers in the vector
342 Solvers
402 Solvers