## Recent Interview Questions

- 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.

- 0of 0 votes
Given a bar chart which the heights of bars are notated as an array of positive integers. Rectangles can be formed in areas covered by one or more bars. Find the largest rectangle.

- 0of 0 votes
How do you go about the phone interview for troubleshooting a problem, say "my computer has become slow 3 times from the last week.". Can someone please give the detailed explanation of how to go about this question. Also, "my internet is not working". How to go about these 2 troubleshooting problems in the phone interview?

- 5of 5 votes
FB On-site March

Q: Find number of Islands.

XXXOO

OOOXX

XXOOX

Return 3 islands.

1 1 1OO

OOO2 2

3 3OO 2

Followup: If the board is too big to fit in memory, how to get the number?

- 0of 0 votes
.

- 0of 0 votes
Given two sets of intervals such as {[1, 2], [4, 8]} and {[2, 5]}. Find their union {[1, 8]} for the two intervals.

- 0of 0 votes
Design a dictionary which words are grouped by the same characters. For example, dog and god are in the same group. And how to make it scalable to handle a huge number of words?

- 0of 0 votes
POWERFUL LOVE SPELLS THAT REALLY WORK

Powerful love spells that really work have been a powerhouse for the successful relationships for ages. Because these love spells are cast with the immense love magic powers specifically to make two people fall deeply in love together.

There is no way that love spells of this kind can ever fail to work most especially if the love magic energies are well balanced to reach out to its targets. Therefore, if you have lost your loved one and then you want your ex lover to get back to you, powerful love spells that really work cast by Prof mamahanisha will give you the perfect results you need.

Powerful love spells are far more useful because of their effectiveness in balancing the feelings of the couples and the resurrection of the dead love bond to repair your relationship and make it to be fun and enjoyable .contact website: http://www.profmamahanisha.com/ email.www.info@profmamahanisha.com call +27789456728/ WHATSSAP for love spells that work

- 0of 0 votes
World Approved Powerful Lottery Spells | Winning Lotto Spells In Europe,Canada,Usa,Uk and Australia

All my Powerful Spells I give Guarantee , I will give you a few hints and spells on how you can expand your luck when you gamble, or play lottery or go into a casino. For all intents and purposes, we as a whole play lottery or go to casinos now or at that point, with an attitude to earn cash, yet when we see that as opposed to getting cash we lose it, we revile our luck as well as imagine that we are not lucky.

If so with you, at that point you will be able to expand your luck for casino, lottery, gambling and so on.… do take note of this that is a luck spell, and ought not be imparted to anybody. It would be implied just for you. You ought not let anybody realize that you are utilizing this spell for yourself, or when you utilize it nobody ought to comprehend that you have utilized this spell.

Lottery spells as from the name, must be with earning money in a brief time frame by winning in lottery, gambling and so forth. Furthermore, now with recession and financial inconveniences wherever there are numerous who would not mind attempting their luck with lottery and winning great money.

http://www.profmamahanisha.com/ email.www.info@profmamahanisha.com call +27789456728/ WHATSSAP

- 3of 3 votes
Find the median of a very big array of integer. Only iterator of array is given

- 0of 0 votes
Given an array of elements print even and odd numbers out of it using 2 threads . even_thread and odd_thread.

int arr[] = {3,1 ,2, 5, 6, 7, 8, 10, 9};