## Recent Interview Questions

- 0of 0 votes
Need to design and develop java program for assigning rankings to “Premier League” players. To start with all the players would have zero points. After every game, points would be updated for players based on the performance. Design data structure and algorithm to print the player rankings after every game.

Sample input and outputs:

Input to program would be of the format “player Id, points from the game”. Example :

1 2

2 1

3 5

1 2

2 3

3 5

- 1of 1 vote
Interleave list of lists in Java

Example:

input = [[1,2,3], [9, 0], [5], [-4,-5,-2,-3,-1]];

output = [1,9,5,-4,2,0,-5,3,-2,-3,-1]

- 0of 0 votes
Input unsorted integer array represents a list of coins,

find the minimum amount of money that cannot be formed by these coins, each coin can only be used once

E.g. {1,1} -> 3, {1,2,4} -> 8

- 0of 0 votes
We have an array if 0's and 1's like

00010000010001001

Assume that all 1's are a person and if a new person comes and if we want to add to the array in such a way that the gap between individuals are maximum as possible.

if we add a new person, then the new array should be

000100100010001001

- -4of 4 votes
Money Spells +27730066655

Money spells are generally Luck Spells focused around wealth and money. Are you in an “I need money” or “I need cash right now” situation? If so let me tell you that My success magic spells are specially designed to make your whole life happier and easier, and to give you the keys to success. +27730066655 or Email : profaafa@yahoo.co.za

, http://www.profaafaspellcaster.com

- 0of 0 votes
Give me a list of int, find the length of the smallest cycle. For example, 1, 2, 1, 2, the length of the cycle is 2. Then 1, 2, 1, 2, 1 has a minimum length of 2. Then the length of 1, 2, 1, 2, 3 should be 5 because the entire list is not in repeat. Then the minimum length of 1, 2, 1, 2, 1, 1, 2 is 2.

- 0of 0 votes
### Problem 3: Theatre Seating

You run a small theater and each month, you have patrons mail in requests for pre-sale tickets. You need to process these ticket requests and either tell them where their party will sit or explain to the patron why you can't complete their order.

You have a few rules that you need to follow when you fill the orders:

1. Fill as many orders as possible

2. Put parties as close to the front as possible.

3. If there are not enough seats available in the theater to handle a party, tell them "Sorry, we can't handle your party."

4. Each party must sit in a single row in a single section. If they won't fit, tell them "Call to split party".

Your program must parse a theater layout and a list of ticket requests and produce a list of tickets or explanations in the same order as the requests.

The theater layout is made up of 1 or more rows. Each row is made up of 1 or more sections separated by a space.

After the theater layout, there is one empty line, followed by 1 or more theater requests. The theater request is made up of a name followed by a space and the number of requested tickets.

Sample input:

```

6 6

3 5 5 3

4 6 6 4

2 8 8 2

6 6

Smith 2

Jones 5

Davis 6

Wilson 100

Johnson 3

Williams 4

Brown 8

Miller 12

```

Your program must produce results to standard output in the same order as the requests, with the name of the person who requested the ticket and either the row and section of the ticket or the explanations "Sorry, we can't handle your party" or "Call to split party."

Sample output:

```

Smith Row 1 Section 1

Jones Row 2 Section 2

Davis Row 1 Section 2

Wilson Sorry, we can't handle your party.

Johnson Row 2 Section 1

Williams Row 1 Section 1

Brown Row 4 Section 2

Miller Call to split party.

- 0of 0 votes
Write a program that controls the traffic signals for a four-way intersection. Initially, we consider traffic flowing in straight lines only, no turns. The four directions are S(outhbound) and N(orthbound) on Snell Rd; and W(estbound) and E(astbound) on Weaver Rd. The traffic lights should obey the following rules:

1. Cars arrive in each direction on both roads (Snell and Weaver) at the rate of 1 car per second. That is, 4 cars approach the intersection each second.

2. Only one road (Snell or Weaver) can have a "green" light at one time.

3. It is acceptable for both roads to have the "red" light at the same time. Of course, traffic backs up on both roads if this happens.

4. Start by turning on the traffic on Snell Rd "green" in both directions for 3 seconds; then turn it "red" for one second; then turn Weaver "green" for 3 seconds; and then red for one second.

5. When the light turns from red to green at any intersection, it takes the first car 2 seconds to start moving and cross the intersection. Subsequent cars take 1 second each.

6. At the instant the light turns from "green" to "red", a car may not start moving to cross the intersection; whether that car just arrived at the intersection or was waiting at that intersection.

7. The output should be the number of cars that are waiting at the intersection in each direction at each second, for the first 20 seconds. Do not make the program wait 20 seconds to produce the output: this is only a simulation, so print the output when it's ready.

8. Expected output

```

0: N = 0; S = 0; E = 0; W = 0

1: N = 0; S = 0; E = 1; W = 1

2: N = 0; S = 0; E = 2; W = 2

3: N = 0; S = 0; E = 3; W = 3

4: N = 1; S = 1; E = 4; W = 4

5: N = 2; S = 2; E = 5; W = 5

6: N = 3; S = 3; E = 5; W = 5

7: N = 4; S = 4; E = 5; W = 5

8: N = 5; S = 5; E = 6; W = 6

```

- 0of 0 votes
Denver International Airport has decided to give an automated baggage system another shot. The hardware and tracking systems from the previous attempt are still in place, they just need a system to route the baggage. The system will route baggage checked, connecting, and terminating in Denver.

You have been asked to implement a system that will route bags to their flights or the proper baggage claim. The input describes the airport conveyor system, the departing flights, and the bags to be routed. The output is the optimal routing to get bags to their destinations. Bags with a flight id of “ARRIVAL” are terminating in Denver are routed to Baggage Claim.

Input: The input consists of several sections. The beginning of each section is marked by a line starting: “# Section:” ``` Section 1: A weighted bi-directional graph describing the conveyor system. Format: <Node 1> <Node 2> <travel_time>

Section 2: Departure list Format: <flightid> <flightgate> <destination> <flighttime> Section 3: Bag list Format: <bagnumber> <entrypoint> <flightid> ```

Output: The optimized route for each bag `

The output should be in the same order as the Bag list section of the input.

Example Input: ```

Section: Conveyor System

ConcourseATicketing A5 5 A5 BaggageClaim 5 A5 A10 4 A5 A1 6 A1 A2 1 A2 A3 1 A3 A4 1 A10 A9 1 A9 A8 1 A8 A7 1 A7 A6 1

Section: Departures

UA10 A1 MIA 08:00 UA11 A1 LAX 09:00 UA12 A1 JFK 09:45 UA13 A2 JFK 08:30 UA14 A2 JFK 09:45 UA15 A2 JFK 10:00 UA16 A3 JFK 09:00 UA17 A4 MHT 09:15 UA18 A5 LAX 10:15

Section: Bags

0001 ConcourseATicketing UA12 0002 A5 UA17 0003 A2 UA10 0004 A8 UA18 0005 A7 ARRIVAL ```

Example Output: `

0001 Concourse_A_Ticketing A5 A1 : 11 0002 A5 A1 A2 A3 A4 : 9 0003 A2 A1 : 1 0004 A8 A9 A10 A5 : 6 0005 A7 A8 A9 A10 A5 BaggageClaim : 12

- 0of 0 votes
Given list of schedules for different flights in a month, determine maximum number of flights that can be in the air anytime in that month.

Input : list of schedules for flights.- spread over a month.

output: a number - maximum flights that can be in the air

Assumptions: 1. All the given times are in a specific timezone( like GMT).

2. Given Schedules can be any time in the month

- 0of 0 votes
Given a list of N threads detect a deadlock in the system.

- 4of 4 votes
Google

Given two lowercase strings, S1 and S2, sort S1 in same order as S2.

If a character in S1 doesn't exist in S2, put them at the end. If S1 is "program" and S2 is "grapo", then return "grrapom".

- 3of 3 votes
Twitter

Count number of each character in a string and print out the counts from highest to lowest.

- 0of 0 votes
Find the kth missing element in a sorted array. For example [2,3,5,7], k = 0: return 4, k = 1: return 6

expected time complexity logn

- 0of 0 votes
how ,Get All Help How to Update Your Netflix Account Information and All devices with Netflix credit

- 0of 0 votes
I want to create a new account in Roku Device..How it will done??

- 0of 0 votes
Given an array of n elements return true if 3 of the sum of 3 elements is equal to a constant c

Example array a[6,2,3,4] constant c = 9

if a[1] + [2] + [3] == c return true

The size of the array is n

If any set of 3 elements is equal to the constant c, then return false

- 0of 0 votes
To an array and K, each element in the array can only move K positions to the left at most, no limit to the right, try to sort the array under the limit of K

a = [5, 2, 4, 3, 1], k = 2

Return [2, 3, 1, 4, 5]

- 0of 0 votes
Given a function rand32() (random number range 0-2**32-1) that randomly generates a 32-bit int, design a new random function:

Randn(n) generates a random distributed random number (0 - 2**n-1)

Rand3n(n) generates (0 - 3**n-1) the uniformly distributed random number

- 0of 0 votes
Topic: There is a set of coordinates. The original format of each coordinate is (1.3, 0.5). However, the comma and decimal point are gone. Only one string is left, allowing you to restore all possible combinations. For example, 123, possible (1, 23) (1, 2.3) (12, 3) (1.2, 3)

- 0of 0 votes
given period and threshold, Assume there is a endless streaming events, each event occurs at timestamp "x". The question want you to write an API that return true if number of the events are over the threshold within the period around timestamp "x"

Ex:

period = 3, threshold =2

getEvent(10) -> false

getEvent(12) -> false

getEvent(13) -> true [10,12,13]

getEvent(20) -> false

part one: event come in order

part two: event come without order

- 0of 0 votes
Given vector<int> nums, and pair<int, int> range. Find out how many continuous subsequences within this vector sum up the number within the range.

Input: [1, 2, 3], [3,6]

Output: (4)

because [1,2,3], [1,2], [2,3], [3]

- 0of 0 votes
Each have a (x,y) coordinate.

Write an API that group three Googler together for lunch if they are close enough. Otherwise, throw them in un-schedule pool.

Distance formula = sqrt((x1-x2) ^2 + (y1-y2) ^2)

Given an int range;

Range: 2

Input | Output of API Un-schedule pool

0,0 -> [] [[0,0]]

1,0 -> [] [[0,0], [1,0]]

3,0 -> [] [[0,0], [1,0], [3,0]]

1,1-> [[0,0], [1,0], [1,1]] [[3,0]]

- 0of 0 votes
Given an vector<int> nums and an int target, you can change any element of the vector to positive or negative. How many uniquely different vector sum up to target?

Input: [1,1,1], target = 2

[-1,1,1]

[1,-1,1]

[1,1,-1]

return (3)

- 0of 0 votes
Given a matrix find the subset sum while performing spiral traversing.

- 0of 0 votes
find max path sum in DAG, weight can be negative

- 2of 2 votes
Given a string with alpha-numeric characters and parentheses, return a string with balanced parentheses by removing the fewest characters possible. You cannot add anything to the string.

- 2of 2 votes
Given a collection of two dimensional points and a number k, return the k closest points to (0,0) by Euclidean distance.

- 3of 3 votes
Search for a target value from a sorted array with unknown size.

- 0of 0 votes
how do Unable To Make Changes To Sbcglobal Account Settings?