## Expedia Interview Questions

- 0of 0 votes
Merge the overlapping intervals.

- 1of 1 vote
Reverse the words in string eg. 'The Sky is Blue'. then print 'Blue is Sky The'.

- 1of 1 vote
Find max sum of subarray

- 0of 0 votes
We define a k-subsequence of an array as follows

1) it is a subsequence of consecutive elements in the array

2) the sum of the subsequence's elements s, is evenly devisible by k(i.e. s % k == 0)

Given an integer and input array, find out the number of k-subsequences.

Example: k=3 and array be [1 2 3 4 1]

Output: 4 ({1 2},{1,2,3},{2,3,4},{3})

- 0of 0 votes
You are given an array with duplicates. You have to sort the array with decreasing frequency of elements. If two elements have the same frequency, sort them by their actual value in increasing order.

Ex: [2 3 5 3 7 9 5 3 7]

Output: [3 3 3 5 5 7 7 2 9]

- 0of 0 votes
You are given two string (like two statements). You have to remove all the words of second string from first string and print the remaining first string. Please maintain the order of the remaining words from the first string. You will be only removing the first word, not all occurrence of a word.

Example: Str1 = "A Statement is a Statement", Str2 = "Statement a"

Output: "A is Statement"

- 0of 0 votes
You are given an integer, print its 4th least significant bit

- 0of 0 votes
Harry is trying to climb a pole. He climbs the pole in terms of hops. The height of the pole is k. Harry at a time can make a hop of:

1.) 1 unit

2.) n units

Find the minimum number of hops Harry would need to reach the top of the pole.

No constraints were mentioned by can be done in O(1) without any extra space.

- 0of 0 votes
Given two positive floating point numbers (x,y), calculate x/y to within a specified epsilon without using in-built functions

- 0of 0 votes
how to get the most tweeted movies in the last 24 hours on twitter?

- 0of 0 votes
Write a function to generate pascal triangle (use recursion)

public static int[] generatePascal(int level)

- 0of 0 votes
1. A server can call an API once per second. How would you ensure that it calls 1/sec given that it's a multithreaded environment.

2. If there are multiple servers how would you ensure that the calls still remain 1/sec.

- 2of 2 votes
1. A server is getting streams of numbers from TCP IP. Write code to get minima/maxima for every 60sec. - The interviewer was looking for code with multithreading as you can perform print of minima/maxima for 60 sec interval and at same time do comparison.

2. If the stream can't be handled by one server and now there are multiple servers how would you calculate minima/maxima? To calculate what optimizations would you do.

3. If now you need to find 10 largest and 10 smallest elements how would you do?

- 0of 0 votes
Log file contains UserId.Every day has new log file.Given range of n days find top 10 users?

- 0of 0 votes
Given an int[] multiply all numbers except index I/p {1,2,3,4} O/P {24,12,8,6} How can you minimize multiplication

- 0of 0 votes
Move all zeros to beginning input {1,2,3,0,0,0,4,5} output {0,0,0,1,2,3,4,5}

- 0of 0 votes
class Node{ int nodeId,int nodeParentId} is given.

Input : List<Node>

Output:Tree

- 0of 0 votes
Design TIC TAC TOE problem

- 0of 2 votes
Given a +ve integer, find the next highest number in the numerical order using the same numbers present in the given integer.

Example : 218765

O/P : 251678

- 0of 0 votes
Difference between struct and class.

When would you use one over the other

What is padding? Do both struct and class have padding

- 0of 0 votes
Explain the underlying working of how inherited function gets invoked. So if Dog and Cat, inherited from Animal, inherit Eats. How does the right Eats get called for Dog/Cat

private inheritance vs composition

When would you use private inheritance

- 0of 0 votes
What is a static function? Explain in detail

- 0of 0 votes
Implement an atoi function in C++

- 0of 0 votes
Difference between threads and process.

When would you use one vs the other

Where on the stack are values stored for their local variables?

If there are two threads each with two local variables, where will these variables be stored

- 1of 1 vote
You have a LinkList with each node having Next node and Other node and Data.

i.e. Class Node

{

Node Next;

Node Other;

int Data;

}

Next pointer always points to next node and Other node can point to any other node in the list or can be pointing to null/nothing or can point to self.

Write program to copy this link list to a new list with proper Next and Other pointers.

- 0of 0 votes
Given a string, print the character which appears the maximum number of times in the string.

The string will contain only ascii characters. If there is a tie in the maximum number

of times a character appears in the string, print the character which appears first in the string.

Notes:

1. The length of the string will be between 1 and 10000, inclusive.

2. Make sure you don't print anything other than a single character in the function. Otherwise, your solution will be marked wrong.

3. You only need to complete the function printMaximumOccurringCharacter.

Sample Input #00

helloworld

Sample Output #00

l

Sample Input #01

aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz

Sample Output #01

a

Sample Input #02

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

Sample Output #02

a

4.

- 0of 0 votes
.There is an infinite integer grid at which N people have their houses on. They decide to unite at

a common meeting place, which is someone's house.

From any given cell, all 8 adjacent cells are reachable in 1 unit of time.

eg: (x,y) can be reached from (x-1,y+1) in a single unit of time.

Find a common meeting place which minimises the sum of the travel times of all the persons.

Input Format:

N

The following N lines will contain two integers saying the x & y coordinate of the i-th person.

Output Format:

M M = min sum of all travel times;

Constraints:

N <= 10^5

The absolute value of each co-ordinate in the input will be atmost 109

HINT: Please use long long 64-bit integers;

Input #00:

4

0 1

2 5

3 1

4 0

Output #00:

8

Explanation: Sums of travel times of the houses are 11, 13, 8 and 10. 8 is the minimum.

Input #01:

6

12 -14

-3 3

-14 7

-14 -3

2 -12

-1 -6

Output #01:

- -1of 1 vote
Two array with integers.Find the value in both of them with out using set.Find the time complexity?

- 0of 0 votes
Find duplicates in a unsorted array and keep the order of integers as it is.

- 0of 0 votes
Write a function to evaluate a string that has only integers, and operators '+' & '*'. The evaluation should be done in a single pass. For example passing "3*2+5*6" should result in this function returning 36.