I would like to submit the following question I was asked
recently during my technical interview at Google.
I'm rephrasing the question to make it clear for everyone
to understand:

- You are going on a one-way flight trip that includes
billions of layovers.
- You have 1 ticket for each part of your trip (i.e: if
your trip is from city A to city C with a layover in city
B, then you will have 1 flight ticket from city A to city
B, and 1 flight ticket from city B to city C.
- Each layover is unique. You are not stopping twice in the
same city.
- You forgot the original departure city.
- You forgot the final destination city.
- All the tickets you have are randomly sorted.

Question are:
- Design an algorithm to reconstruct your trip with minimum
complexity.
- How would you improve your algorithm.

Example:
- randomly sorted:
New York->London
San Francisco-> Hong Kong
Paris->New York
London->San Francisco

- sorted:
Paris->New York
New York->London
London->San Francisco
San Francisco-> Hong Kong

Answer Posted / samir

Find the ticket which has a unique TO destination. That
destination should not occur in FROM field in any ticket

:)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to downlaod image to target system? what is the vi editor?

2021


What, if anything, is the difference between "executing" a processing instructions and "processing" a processing instruction? Are the terms "executing" and "processing" interchangeable?

1865


What are the Rules of Desktop Publishing?

1637


Explain various phases of the SDLC.

567


How to Design a Good Newsletter?

1654






what stage/s of the development lifecycle should end users be involved?

542


What is an authoring tool?

1485


why is testing neccessary?

1647


give difference between generic & iterative process model.

1728


Can you explain why software is called a product?

625


The procedure of hiring fresher’s in CEI is as follows. Only graduates from an engineering background with specialization in ECE (Electronics and Communications), Computer science and IT streams are accepted. We also accept students who have completed their Masters in Computer Applications. Only those candidates who have a score of 70% and above throughout their academics are considered. We follow a four level procedure for selecting any fresher to be part of our highly skilled technical team. These include: 1. Written Test 2. Technical Interview 1 – Conducted by CEI Developers 3. Technical Interview 2 – Conducted by CEI Project Managers 4. HR Discussion The written test is divided into 3 sections as mentioned below: 1. Logical: Critical Reasoning and Analytical Reasoning – 30 Questions 2. Quantitative Aptitude – 25 Questions 3. Technical Questions – 25 Questions Logical: These questions primarily test the analytical and critical thinking skills of the applicants. It tests the most integral skills of the applicant, the logical consistency in thought, understanding and processing data and making valid conclusions from them, and out of the box thinking. The best part about logical reasoning is that it does not require any learning or prior knowledge. Example: • If the positions of the first ten letters and the last ten letters in the English alphabet are interchanged such as that the first and the seventeenth the second and the eighteenth letters are interchanged and this continues till the tenth letter is interchanged with the twenty-sixth letter, which letter will be the fifth to the right of the twelfth letter from the right after this rearrangement? • There is a 3 digit number. The sum of the digits is 17, and two of the digits are the same. The unique digit subtracted from one of the other digits equals a positive even number. What is the digit that is different from the other two digits? Quantitative aptitude Section consists of questions related to Simplifications, Data Sufficiency, and from the topics of Arithmetic. For e.g.; Fraction, Profit and Loss, Combinations and Permutations, Percentage problems, Ratio, Probability, Allegations and Mixtures, Time and distance, Time and work, Measurements, etc. Example: • A sales person by mistake multiplied a number and got the answer as 3, instead of dividing the number by 3. What is the answer he should have actually got? • A traveler walks a certain distance. Had he gone half a kilometer an hour faster, he would have walked in 4/5 of the time, and had he gone half a kilometer an hour slower, he would have walked 2 ½ hours longer. What is the distance? • Two taps A and B fill a tank in 12 and 20 hours respectively and a third tap C empties it in 15 hrs. In how many hours will the tank be filled if the taps A and B are opened simultaneously and C is opened after two hours.? Technical Section consists of sections related to basics concepts of programming languages, and some basic entry level programming are given to assess the applicant’s ability to solve the program. Example: • An alternate to using interrupts for I/O devices is • The main advantage of using indexes is • PRODUCT Product ID Product Description Manufacturer ID MANUFACTURER Manufacturer ID Manufacturer Name Referring to the above table, what type of relationship exists between the Product table and the Manufacturer table?  Once a candidate clears the written test they will be considered for the second round.

2905


What may be the different component of Build phase? Build is not directly phase in SDLC, but its major part of SDLC, so need to know the different components for this including dcoument process.

1769


Describe your design ability ?what is your Architecture design GPA as it compares your general GPA?

1876


What are the difference phases of software development? Explain briefly?

545


How to Design a Good Ad?

1554