## Recent Interview Questions

- 0of 0 votes
Take a string as input and add the digits present in that

string.

Ex:I/P="asdf12bgt3bh5j"

O/P=20

I/P="iuy2hjg4jhg8"

O/P=14

I/P="7 13"

O/P=20

- 0of 0 votes
Take an array of integers as input. print the pair of

prime number and even number. Remaining numbers

should appear at the last.

Ex: I/P=[1,5,9,7,3,6,8,13,2,4]

O/P=[5,6,7,8,3,4,1,9,13,2]

- 0of 0 votes
Given N co-ordinates on a 2D plane, find two co-ordinates such that their slope is maximum. An efficient solution was asked.

- 1of 1 vote
Given an array such that every next element differs from the previous by +/- 1. (i.e. a[i+1] = a[i] +/-1 ) Find the local max OR min in O(1) time. The interviewer mentioned one more condition that the min or max should be non-edge elements of the array

Example: 1 2 3 4 5 4 3 2 1 -> Local max is 5

1 2 3 4 5 -> No local max or min exists

5 4 3 2 1 -> No local max or min exists

- 1of 1 vote
Given an array of int return the maximum difference of any pair of numbers such that larger number of the pair occurs at higher index than the smaller.

- 0of 0 votes
Find minimum number of swaps to convert one binary array to another.

Note: It is always possible.

You are given two integer array having only 0's and 1's. Find minimum number of swaps to convert array1 to array2.

NOTE: You can only swap adjacent elements.

- 2of 2 votes
Sparse number is an integer if there are no adjacent 1 in it's binary representation.

Like: 5 -> 101 (no adjacent 1)

9 -> 1001 (no adjacent 1)

while 6-> 110 is not sparse number.

Now you are given an integer find the NEXT BIGGER sparse number.Please mind 'it is next bigger'.

- 0of 0 votes
Graph problem:

Critical node: If a node reaches another node only through one node.

Eg: A-C-B and A-E-B are critical nodes. (A reach B through one node which is C or E)

If A reaches B through more than one node, then they are not critical nodes.

1) A-C-B

A-D-E-B (A reach B thro C which might lead to critical node but A has another path to B thro D and E, so they are not critical nodes).

2) X-Y-Z

X-A-Z (X and Z are critical nodes)

Now find all critical nodes.

- -2of 4 votes
public class MyClass {

public static int num=1;

public static boolean flag=false;

public static void main(String[] args) {

Thread t =new Thread(new MyThread());

t.start();

MyClass.flag=true;

MyClass.num=10;

}

}

class MyThread implements Runnable{

public void run() {

while(!MyClass.flag){

Thread.yield();

}

System.out.println(MyClass.num);

}

}

Output of this code and the reason for the output?

- 1of 1 vote
Given a number such as 123 having digits 1,2 and 3.

Now Product of Number and its digits is = 123*1*2*3 = 768. Now 123 is the seed number for 768. You would be given a number and you have to identify whether any seed element exists for that number. for Ex: - 4977 has two such seed numbers 79 and 711. You have to print both.

- 1of 1 vote
During appraisal due to bell curve funda a manager is restricted to give promotion to only one of his team members. Three of his team members are equally competant. He wanted to select one by giving a puzzle. He called his three talented team members and blidfolded them. He placed a hat on each of their heads. Manager took off their blindfolds and gave following clues and conditions

1) Each hat is either white or blue

2) There is atleast one blue hat

3) Contest is fair for all the three team members

4) Each team member can see the hat of other team members but not his.

5) The team members should not communicate to each other.

The manager declared that who ever comes up first with right answer shall be given promotion.

The most talented of his team members came up with right answer and explanation.What is the answer and the logic behind that?

- 0of 0 votes
Given two sorted LinkedLists, merge them into one sorted LinkedList

- 0of 0 votes
Hashmap(what is it, time complexity of insertion and deletion)

- 0of 0 votes
WORD PROBLEM:

Tara has already spent 6 minutes on the telephone and she expects to spend 9 more minutes with every phone call she routes. In all, how many phone calls does Tara have to route to spend a total of 14400 seconds on the phone?

Print the result.

- -3of 3 votes
What does Innoplexus ask about in the personal interview round for Technical Summer Interns?

- 0of 0 votes
Design a hotel reservation system. To make it simple, we assume that the hotel has only one building and the building has only one floor. Design your objects so that they work better with a non-sql database, say a document-oriented database.

- 1of 1 vote
Design an optimised algorithm to solve snakes and ladders with the least amount of roles possible under the assumption that you get whatever role you want when you role the dice.

- 2of 4 votes
Given an unsorted array of natural numbers. Where numbers repeat in array. Out put numbers in the order of frequency. Where number of out put is passed as parameter.

For Ex:

Array -> [0, 0, 100, 3, 5, 4, 6, 4, 2, 100, 2, 100]

n -> 2

Out put -> [100, 0] or [100, 2]

Since 100 is repeated 3 times and 0, 2 is repeated 2 times, out put up to 2 most frequent elements, program should out put either 100, 0 or 100, 2

- 0of 0 votes
This is a two part question related to Markov string generation.

Part 1: Read a training set of strings. For each character in any of the strings, calculate the probability of seeing that character and store it for later use. (this part is about coming up with the right data structure and correct probability calculation).

Part 2: Based on the training set from Part 1, generate a random string of length N.

- 0of 0 votes
Given an API ReadFromDisk() which returns a block of 256 bytes from disk. Implement the API Read(SizeInBytes) which reads SizeInBytes bytes from the disk by calling only ReadFromDisk. Notice that every call to ReadFromDisk() will read the next 256 bytes from disk.

- 0of 0 votes
Given an API ReadFromDisk() which returns a block of 256 bytes from disk. Implement the API ReadEx(SizeInBytes) which reads SizeInBytes bytes from the disk by calling only ReadFromDisk. Notice that every call to ReadFromDisk() will read the next 256 bytes from disk.

- 0of 2 votes
write a function that calculates the minimum number of meeting rooms that can accommodate given schedules

input: same

output: # of rooms

Also back to back events are allowed e.g. {2,5} {5,9} correct o/p:1

- 1of 1 vote
write a function that detects conflicts in given meeting schedules

input: a list of intervals, [(s1, e1), (s2, e2), ]

output: return True if there's any conflict, False otherwise

- 0of 0 votes
The last one, he gave me one single line : " amazon is a . blah blah blah.." then he told me to compress it.

I used the indexes,occurences. But then he told me to use other way. after he gave me some hint, I was able to find out the palindrome pattern. we can use that too to compress the string.

Then he told me to write algorithm for palindrome, I wrote with O(n/2) complexity. then he told me to find any longest palindrome from the string. I need to use my palindrome algorithm too.

I tried a lot and then I came up with O(n^3) solutions. he pushed me to try to reduce with O(n^2) solution. However, I could not come up with that solution.

- 0of 0 votes
Based on the above question, he asked me that I have a very large file with all the details of product, like id, name, qty_sold, date. then he told me to find out the products that will have a better chances to be sold out next week. I have to find out the products that will sell more in next week.

- 0of 0 votes
Second round was intersting: that guy gave me a situation, like I have a file with columns product_id, qty, date, product_name.

I need to sort them based on qty that has been sold out on day. For example, this product has been sold highest on this day.

- 0of 0 votes
In my First round, very first question that guy asked me is to generate an algorithm to check whether string is palindrome or not. After that in the same round, he asked me to create a class that duplicates the Stack property.

First, String Palindrome:

Used stringbuilder, i.e.`StringBuilder sb = new StringBuilder(str); System.out.println(sb.reverse());`

then he told me to not to use StringBuilder, so i convert string into the char array, then apply loop till half the size of the string. and check character by character. He said ok. "looks good".

- 2of 2 votes
You are given printouts from an algorithm which ran over an unsorted binary tree. One printout is from an in-order run and another from a pre-order run. Can you reconstruct the tree? If so, then write an algorithm.

- 1of 1 vote
You are given printouts from an algorithm which ran over a sorted binary tree. One printout is from an in-order run and another from a pre-order run. Can you reconstruct the tree? If so, then write an algorithm.

- 0of 0 votes
Design banner in a web page which will show changes in Sensex live.