Google Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
3
of 3 vote

Please state question clearly.

What is given?
What is expected?
What is allowed/ not-allowed?

- tc March 03, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use trie structure to store number and while typing the number traverse through all the nodes till all the leaves.

- sjain February 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

how about using a prefix tree (trie) data structure:
key #1 (1,2,3)
key #2 (4,5,6)
key #3 (7,8,9)
key #4 (0)
if dial 415-6789-5432 then dial 212-233... with automatic completion provided

- Joanna8848 February 28, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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)

- Dmitry February 08, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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)

- Dmitry February 08, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

void phoneNumbers(const string &dialString, string prefix) {

	if (diaString.length() == prefix.length()) {
		std::cout<<prefix<<endl;
	return;
}
	for (int i=0; i<9; i++) 
		phoneNumbers(diaString, prefix+(‘0’+i));
}

- shengzhc March 09, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More