# Expedia Interview Experience(On Campus for internship 2020)

Expedia visited our campus in August for recruiting interns. The process began with an online round followed by 3 interview rounds.

The online round consisted of two sections: 2 coding questions and 10 technical multiple choice questions. Time limit: 90 minutes. Platform: HackerRank. This was a fairly easy round.

Q1. You are given a number n. You have to tell how many prime numbers less than or equal to n exist. For ex. if n=10, your answer should be 4 as {2, 3, 5, 7} are primes below 10.

Q2.  You are given two strings A and B. You have to output a string C, which is formed by letterwise interleaving of A and B. For ex. if A=”abc” and B=”efg” output C should be “aebfcg”. Another ex. A=”abc” B=”pqrst” then C=”apbqcrst”.

About 25 students were selected for the next round.

Round 1: Technical Interview 1

Next the interviewer asked me about my favourite data structure. I said Linked lists. So she gave me the following problems:

1.Write a program to reverse a linked list.

2. Write a program to reverse linked list in groups of given size ‘K’.

3.You are given a very large number which is in the form of a singly linked list such that each digit is a node. For ex. 123 is written as 1–>2–>3. Now you have to add 1 to the number and return its head.Remember you only have a singly linked list. So i told her that we can initially reverse the list.Alongside we maintain a variable carry and add 1 to the new head of the reversed  linked list(that would be the last digit of the number). New value of the first node becomes (1+(initial value))%10 and carry for that node has the value (1+(initial value))/10. Also for all other nodes, new value=((carry+(initial value))%10 and carry=(carry+(initial value))/10 .

for ex. if we are given 129, so initially  1–>2–>9 becomes 9–>2–>1.First adding 1 to 9 gives us 10 so new value =10%10=0 and carry=10/10=1, so list changes to 0–>2–>1 with carry of 1 st node=1. New value of 2nd node=(1+2)%10=3 and carry=3/10=0., so list changes to 0–>3–>1 with carry of 2nd node=0. New value of 3rd node=(0+0)%10=0 and carry=0. so list becomes 0–>3–>1. Reversing the list we get 1–>3–>0 which is required answer.

She was satisfied with my solution and then asked for any special cases for this problem. I thought for a while and responded that if initially we are given a number with all 9’s as digits we would have to add an extra node(with value 1) in the resultant list to get the answer. For ex. we are given 9–>9–>9 reversing it gives us 9–>9–>9 we add 1 to head alonwith the carry method which gives us 0–>0–>0 and 1 carry over left. So we add an extra node with value 1, i.e. 0–>0–>0–>1 and reverse it to get 1–>0–>0–>0.

13 students were further selected.

Round 2: Technical Interview 2

Again, I was asked to introduce myself briefly. Then they asked me questions based on my CV.

After that came the questions:

1. How to design a tiny URL shortener. Solution: https://www.geeksforgeeks.org/how-to-design-a-tiny-url-or-url-shortener/
2. Given two linked lists, find if they are merging at some node or not. One solution I gave was that for the first linked list we traverse it completely and store the references in a hashset(Java). Now while traversing the second linked list if we find a node whose reference is already stored in our hashset, we have found the merging node else no merging node exists. But since this method used memory I was asked to optimise it. So I proposed another solution: We can find the difference in sizes of the 2 lists (D), Traverse the longer list by D nodes and then simultaneously traverse both lists together, if at any point we find that list1.next==list2.next, We have found the merging node else no such node exists.
3. Find the length of the longest Consecutive 1s in Binary Representation of a number. For ex. n=14 Binary representation=1110 which should give us output as 3. Refer to:https://www.geeksforgeeks.org/length-longest-consecutive-1s-binary-representation/

10 students were selected for the final round.

Round 3: HR round

Unfortunately, I was not selected for the HR Round.

But the questions asked in the HR round were quite general like tell us where you see yourself in 5 years, why do you want to join us etc.

Finally 6 students got selected.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

1

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.