Google Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Phone Interview
There are about 200 countries. Each country have a) own country code (which starts with + sign), b) 10 digit phone identification number (vast majority of countries follow this standard).
Summarizing these facts we get 2 * 10^2 * 10^10 which is 2 * 10^12 total phone numbers in the world.
Enumerating is quite easy:
1. enumerate through countries phone codes (finite list of about 200 items)
2. run tenfold loop and output the string of a kind "+XX" (country code) "i0i1i2i3i4i5i6i7i8i9"
Watch for:
1. There are might be exceptions for some countries that might have 7 to 9 phone numbers internally
2. Some countries allow having alphabetical characters in a phone number (which are being translated to a digit ones through some centralized name stores)
There are about 200 countries. Each country have a) own country code (which starts with + sign), b) 10 digit phone identification number (vast majority of countries follow this standard).
Summarizing these facts we get 2 * 10^2 * 10^10 which is 2 * 10^12 total phone numbers in the world.
Enumerating is quite easy:
1. enumerate through countries phone codes (finite list of about 200 items)
2. run tenfold loop and output the string of a kind "+XX" (country code) "i0i1i2i3i4i5i6i7i8i9"
Watch for:
1. There are might be exceptions for some countries that might have 7 to 9 phone numbers internally
2. Some countries allow having alphabetical characters in a phone number (which are being translated to a digit ones through some centralized name stores)
Please state question clearly.
- tc March 03, 2013What is given?
What is expected?
What is allowed/ not-allowed?