## Recent Interview Questions

- 0of 0 votes
There are N (N > 20) team, each team will play 'M' (say M =3) league match against every other team. Design various classes, and write the code and algorithm to find the winner.

Note: One match can be played on a single day, as there is just one stadium.

Note: No team should play matches on consecutive days.

Note: Algorithm should come up with Quarter Final, Semi Final, and Final matches.

Follow-up Question: If N is odd or even.

How your design will be modified if there are 'S' no. of stadiums.

- 1of 1 vote
convert a Sorted array to complete BST

- 0of 0 votes
Design a Twitter-like topic system so that the most popular topics can be retrieved from the system. A post can have one or more topics and these topics can be shared by multiple posts. (hint: thinking of scalability)

- 0of 0 votes
How HP Customer Support Works for Users?

- 0of 0 votes
Give a connected graph, no cycle,

Find the node where the average distance from all other nodes is the smallest

- 0of 0 votes
Input: an int array without sorting, then do a binary search on it, and find the number of digits that cannot be found by binary search.

- 0of 0 votes
<key = "a"; val = "3"; depend_list = null;/>; <key = "b"; val = "a * a";

Depend_list = {a};/>; <key = "c"; val = "a * b"; depend_list = {a,b};/>;

Lets output a map<key, value>,a -> 3, b -> 9, c -> 27

Follow-up questions: Make a statistic for all keys and corresponding map entries with the same value.

- 0of 0 votes
Given an array, find an x such that all numbers less than x are equal to themselves. Numbers greater than it are equal to x, and all numbers add up to a target

For example, [1 3 5 7 9] target=24, answer is8. Because when x=8, the array has only 9>8, so 1+3+5+7+8=24 is the closest to the target.

- 0of 0 votes
Give an N-length array with only 0 and 1 inside

Requires to find the minimum number of conversions needed to convert the array to 0 before all 1.

The conversion is to change a 0 to 1 or a 1 to 0,

And the number of 0 and 1 in the converted array can be arbitrary.

Just find the minimum conversion step

- 0of 0 votes
Why Do You Need of QuickBooks Support?

- 1of 1 vote
Assume courses labeled by their index in an array. Given a list of pairs where the first element represents a prerequisite course required for the second course, derive an ordered list of courses.

- 0of 0 votes
For a given set of non-negative integers get the number of subsets that add up to a target value k.

- 0of 0 votes
For a given array of integers compute the maximum sum of any range in the array. Then modify the function to find maximum product (note the effect of negatives on max product).

- 0of 0 votes
Write a function to compute n^k. (don't forget negative exponents)

- 0of 0 votes
Print (or return) the longest movie title found by successively matching the last and first words in each title, joining to form new titles, given a file containing a list of movie titles.

For example: 'OF MICE AND MEN' and 'MEN IN BLACK' join to form 'OF MICE AND MEN IN BLACK'.

You could further join 'OF MICE AND MEN IN BLACK' wth 'BLACK MASS' to form 'OF MICE AND MEN IN BLACK MASS'.

The longest title I found (at 143 characters is): WENT TO CONEY ISLAND ON A MISSION FROM GOD BE BACK BY FIVE WIVES THREE SECRETARIES AND ME WITHOUT YOU CANT TAKE IT WITH YOU WERE NEVER LOVELIER

- 0of 0 votes
Problem:

Insert + or – sign anywhere between the digits 123456789 in such a way that the expression evaluates to 100. The condition is that the order of the digits must not be changed.

e.g.: 1 + 2 + 3 – 4 + 5 + 6 + 78 + 9 = 100

I have below C solution - Can you please help me to convert to Java. I need this solution in Java.

#include<stdio.h>

#include<conio.h>

int findnumber(int i,int j)

{

int k;

int n;

for(k = 0; k < j; k++)

{

n = i % 3;

i = i / 3;

}

return n;

}

void main()

{

int i, j, k, current, result, operation;

clrscr();

for(i = 0; i < 19683; i++)

{

if(i%3 == 0)

continue;

current = 0;

result = 0;

for(j = 1; j < 10; j++)

{

k = findnumber(i,j);

if(k==0)

{

current = current * 10 + j;

}

else

{

result = result + (operation == 1 ? current : -current);

current = j;

operation = k;

}

}

result = result + (operation == 1 ? current : -current);

if(result == 100)

{

for(j = 1; j < 10; j++)

{

k = findnumber(i,j);

if(k==0)

printf("%d",j);

else

printf("%c%d",k==1?'+':'-',j);

}

printf("\n");

}

}

getch();

}

- 0of 0 votes
Imagine a horizontal corridor bounded by y = y1 and y = y2 lines on a 2D-plane. There are N sensors with centers (x, y) each of which operates in a range (r) on the plane . So, they cover some circular areas on the plane. See the figure below.

`o | _____o___o__|____________ y = y1 o |OOO __________oo|_____O______ y = y2 O | O _ _ _ _ _ _ | _ _ _ _ _ _ | o O | o O O | | O | |`

The question is whether a path exist from x=-inf to x=+inf via corridor without being detected any radar.

Constraints:

1. You are free to move any direction only if you stay in the corridor.

2. You are free to go through corridor borders.

3. N sensors are given as list of (x, y, r) like [(1, 3, 2), (-1, -3, 4)]. x and y are signed integers. r is a unsigned integer.

4. y1 and y2 are integers.

My solution:

1. Create an intersection graph of N sensors by comparing them each other via Euclidean distance`(x1 - x2)^2 + (y1 - y2)^2 <= (r1 + r2)^2`

2. If there is a path between y=y1 and y=y2 through intersected sensors, there do not exist any path from x=-inf to x=+inf. Otherwise, there do exist a path. So, I used BFS to search such a path.

Worst Case Complexity:

1. O(n^2)

2. O(V + E) = O(n + intersection_count)`Total: O(n^2)`

My Best Case Optimization for Intersection Graph:

1. For each sensor, create two events for start and end of circles vertically. y = (y1 - r) and y = (y1 + r)

2. For each sensor, register those two events into an array.

3. Use a line sweep algorithm over 2, which is O(nlogn + intersection_count) and intersection_count may be n^2 at worst case.

I wonder if I should have had a better solution with the worst case < O(n^2).

- 0of 0 votes
Numbers with 4 are considered to be unlucky, floor numbers are skipped with numbers with 4; for a top level n, ask how many layers there are actually; for example n=20, that is 18 levels [Remove 4, 14]

- 0of 0 votes
Ammo Board offers great deals on bulk quantity ammunition for you 9mm, 10mm, 40 colt, 40 S&W, Rifles, Shotguns & Rimfire and more. Top brands available : Wolf Ammo, Winchester Ranger, Winchester Pheasant, Federal Gold Medal, Federal Nosler Partition and more.

Free Shipping always!

- 0of 0 votes
Language : java

Find the length of the non repeated numbers in an array.

Input : 1,2,2,3,4,5,6,2,3

- 0of 0 votes
You are given the length and time of occurrence of packet and Queues which process packets. Total processing time for a packet is equal to the length of packet plus the waiting time in queue. For eg lets say we have only one queue for now, and A packet of length 5 comes at t = 1, and another packet of length 4 comes at t = 3. Total processing time for first packet is 5( no waiting time as queue is empty at t = 1) and at t = 3, 2 units of first packet is processed and 3 units remaining so, for second packet 3 units will be waiting time in queue plus 4 units for its length. Total processing time for 2nd packet is 7 units. If there are multiple queues you can add new packet in any of the other queues. Given the time and length of all incoming packets, we need to find the minimum no. of queues required such that total processing time of each packet is less than 10 units. Maximum possible no. of queues are 5. If you require more than 5 queues print -1.

Test Cases Format: First Line contains the number N, the total no. of packets and N following line contains two numbers ti, li where li is length of packet coming at time = ti units.

Test case1:

2

2 7

5 8

Test Case 2:

3

1 3

2 3

3 5

Test Case 3:

3

1 5

2 4

3 8

Output:

Case1: 2

Case2: 1

Case3: 2

Consider the following time table of incoming packets:`time packets-length 1 8 2 5 3 2 4 6`

If you put the packet in queue with minimum time then this will lead to 3 queues:

t = 1:

q1: 8

t = 2:

q1: 7

q2: 5

t = 3:

q1: 6

q2: 4, 2

t = 4:

q1: 5

q2: 3, 2

q3: 6

But its output should be 2 queues:

1) 8 in queue 1

2) 5 in queue 2

3) 2 in queue 1

4) 6 in queue 2

- 0of 0 votes
Kaspersky Customer Service 0800-046-5071 Number UK

- 0of 0 votes
What should a user do to fix Kaspersky troubles?

We can’t decline this fact that antivirus program is not needed. It is essential because it safeguards the computer from harms like Trojans, spyware and more. However, there are technical issues, found by the users such as slow running of PC after installation, scan time takes too long, and firewall issues. At the time of facing an issue, you should talk to the technicians to find the accurate resolution of any sort of technical trouble. They are experienced in this arena as well as familiar with the issue and their resolution to know more about them, you must visit the link http://www.anti-virussupport.co.uk/support-for-kaspersky.html

- 0of 0 votes
I read this question here in careercup and saw no comments on it. So, I am answering it.

given a string find the sum of number of unique substring characters.

means if string is ACAX. the sub strings are A,C,A,X,AC,CA,AX,ACA,CAX,ACAX. in ACA, A occurs more than once so, its count is not considered, but C occurs once so its count is 1. Similarly in ACAX, A's count=0,C's count=1,X's count=1. In such a manner find sum of all counts for all substrings. The worst case time complexityis O(n). IF same substring occurs more than once then find its sum for that many times.

- 0of 0 votes
Having Issues In Bigpond webmail account, Contact Bigpond webmail toll-free Number @ 1800-021-482 for support services online?

- 0of 0 votes
Customer Support number Yahoo Password Recovery 1-877-336-9533

- 0of 0 votes
How do I update my TomTom maps for free?Call Toll Free No. 1800-215-732

- 0of 0 votes
You are given an array of length N that contains only integer.

A number in this array is called a special number if it is divisible by at least one other number in the array.

Write a program to print the count of special number of array.

Input format :

First Line - N

Second line - N space separated integer.

Output format :

print the count of special number in the array.

constraints

1<= N <= pow(10,5)

Note - divisible with same number will not considered.

Example -

input

N=3

Array= 5 3 10

output

1

Description - 10 is divided by 5,

5 and 3 are not divided by any number

- 0of 0 votes
How to choose the best Ammunition for Rifles, Handguns & Shotguns.

- 0of 0 votes
You are given an array of strings. For example, ["AB", "BC", "FOO", "ZA", "BAZ"]

- Output strings where you can get from one to the other using any ROT transformation.

ROT_1(AB) = BC

ROT_1(BC) = CD

ROT_25(AB) = ZA

AB,BC you can go from one to the other using ROT_1

Input: list of strings

Output: strings where you can get from one to the other using any ROT transformation.

Example:

Input : ["AB", "BC", "FOO", "ZA", "BAZ"]

Output: [ [ab, bc] , [ab, za] ]

AB,BC because you can go from one to the other using ROT_1

AB,ZA because you can go from one to the other using ROT_25

Do not return FOO, BAZ you can’t get from one to the other.