Google will interview questions throughout the course, so please be patient ..

Source: Internet
Author: User
Http://www.mitbbs.com/article_t/JobHunting/31828487.html

Sender: maxq (ZF), email area: jobhunting
Question: Google Answers questions throughout the interview, so comfort...
Mailing station: BBS untitled Space Station (Tue Mar 22 00:34:25 2011, US East)

After three months of intermittent interviews and preparation, I recently spent a lot of time preparing for the interview,
I thought that the last interview could make up for the shortcomings, but unfortunately it was still a loss of money...
I think it is mainly because my programming level is not good, and I cannot quickly write the bug free code. In addition
Design andAlgorithmThere is a gap between the two sides. In addition, the preparations are insufficient.
Still not supplemented

I would like to share my interview questions with you and hope you can get an offer.

1) a sequence of a range (linked list or array), such as [], [], [], []
WriteProgramMerges overlapping ranges. For example, the preceding sequences are merged into [], [], and [].

If the sequence is not static but a data stream, how can this problem be solved?

=> Later I heard about the Interval Tree, but I still don't know how to solve it,
Can someone tell me in detail?

2) The array is divided into three parts by the division method of quick sorting: <Val, = Val,> Val.

=> Later I found that programming peals had the original question ..

3) For dynamic data streams composed of words queried by Google, 10 completely random queries are retrieved at any time.

=> At that time, I did not answer the question. Later, I found the classic reservior sampling on the board. It would be nice to go to the Panel early to see the face Sutra ..

4) convert a string to a 32-bit integer.

=> Handle overflow

5) Search for three numbers in an array so that their sum is 0.

=> This is an extension for finding two numbers with the sum of 0.

6) an array is usually used to represent two-dimensional arrays, but the number of elements in each row can be different to implement the get and set functions.

=> This is relatively simple.

7) it is known that the length of each string to be searched is 10. How to quickly search for such a string in a long string Sequence

=> At that time, the idea was to traverse the string and calculate the sum of all strings with a length of 10,
Similar to sum = A0 * 10 + A1 * 10 ^ 2 +... + A9 * 10 ^ 9, then use the sum
For hash, the interviewer Ms thinks it is still sloppy. There should be a better way.

8) write a program to generate the following square matrix with the edge length of N

1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7

=> Generate clockwise. Pay attention to the boundary condition.

9) The re-order Buffer Design of the application can be discarded if it is full.
It is probably the data packet that the application needs in order, but the received data may be out of order.
(Similar to an IP segment, each data segment has a serial number, but different data segments
The order of arrival to the application may be different from the order of sending, causing disorder ). Then there are
A buffer can store several data slices. How can I design an algorithm through this buffer?
Turn data slices into orders. We have discussed how to reassemble Parts Based on IP addresses and set timer and ack,
The interviewer seems not satisfied. I don't know what the correct solution is.

10) Suppose there are many polygon and the largest is the Earth. Every country can think of a polygon. every province, city, district, community, or building can be considered as a polygon, these polygon are either contained in each other or have no intersection (no overlap exists ). To give a polygon, write a program to find the smallest polygon containing it. A ready-made function is known to determine whether two polygon contain each other, iscontained (poly P1, poly P2 ).

How to accelerate? What if it is in the case of multiple hosts?

=> A tree structure can be used to represent the contained relationship.

Binary search can be used for acceleration.

If there are multiple hosts, You can range one machine to process one region. In addition, consider the load of the front-end processor instead of becoming a bottleneck. Therefore, let each machine determine whether the polygon is included.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.