## Recent Interview Questions

- 1of 1 vote
Given an Array A with n elements. Pick maximum number of elements from given array following the rule:

1. We cannot pick A[i] and A[j] if absolute value of (A[i] - A[j]) > absolute value of (i - j)

Example: {13,5,4}

Ans: 2

Pick 5 and 4.

- 1of 1 vote
A frequent traveller collects all his travel tickets.

A ticket has only 2 attributes, Start Journey Location name and Destination Name. Example from Delhi to Mumbai.

At the end of the year, the traveller gets all his tickets together and tries to map his journey across the year. Print his travel route in a readable format. He does not remember his start location.

Edit: he can visit a location multiple times, and can also go back and forth a place several times.

- 0of 0 votes
http://www.buycakeonline.in/corporate-cakes.php

- 0of 0 votes
Problem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

Nearest meeting cell: Given any two cells - C1,C2, find the closest cell Cm that can be reached from both C1 and C2.

Note: Aim for O(Log(N)) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

Third line contains two cell numbers whose nearest meeting cell needs to be found. (return -1 if there is no meeting cell from the two given cells) .

OUTPUT FORMAT - Find nearest meeting cell (NMC).

- 0of 0 votes
Problem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

find Maximum number of entry points (incoming edges) for any cell in the maze

Note: Aim for O(N) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

OUTPUT FORMAT - Find max entry points in any cell.

- 0of 0 votes
Problem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

The length of the largest cycle in the maze. Return -1 if there are no cycles.

Note: Aim for O(N) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

OUTPUT FORMAT - length of the largest cycle.

- 0of 0 votes
There is a 2D grid and there are two players P1 and P2. Their x,y positions are given. Then there are N gems on the grid and their positions are also given. The two players together are supposed to collect the gems in the given sequence making minimum moves (movement in all 8 directions is considered as 1 move). Note: the gems should be collected in the given order by either one of the players and then their position then becomes the position of the gem.

- 0of 0 votes
Either C or C++ is faster and which one is efficiently access memory?

- 0of 0 votes
Can we execute a C program with out main?

- 0of 0 votes
Write a C program to check biggest among two numbers with out using any relational operators.

- 0of 0 votes
Implement method:

`Lìst<Range> getRanges(Lìst<Shard> shards, Lìst<Key> keys)`

That returns list of ranges. Each range represents multiple keys aggregated over a shard:

n-keys —> 1-shard —> l-range

Method should return no more than 1 range per shard that spans all keys or their parts belonging to this shard.

Each of the ‘Range` , 'Shard’ and ‘Key’ classes have ‘end’ and ‘start’ fields of int type, where ‘start’ is inclusive and ‘end’ is exclusive.

Example:`1—9, 12—59, 100—999 <— shards (input) 2—3, 6—8, 11—20, 200—220 <— keys (input) 2—8, 12—20, 200—220 <— ranges (output)`

- 1of 1 vote
Given: sorted array of integers

Return: sorted array of squares of those integers

Ex: [1,3,5] -> [1,9,25]

Integers can be negative.

- 0of 0 votes
Write a program which will get the top 'x' tweets based on their re-tweet count from 'n' tweets.

- 0of 0 votes
Given (a,b) can you reach to (c,d) if a and b can move either (a+b,b) or (a,a+b). Example a =1, b=4,c=5,d=9 then (1,4) -> (5,4) -> (5,9)

- 0of 0 votes
Suppose there is a social networking site like Facebook. Every user gets some friend recommendations (i.e. People you may know!). Now, if there is a user A and he has 100 friends and each of his friends has got 5 other friends,A can get these 500 recommendations. But the condition is that he should only get the top 10 recommendations with whom he has the maximum number of mutual friends(If A and B are friends and B and C are friends, then A and C have a mutual friend, B). Suggest an efficient data structure for this and how to implement it. The implementation should be flexible as at any moment, any user can make new friends and he may also unfriend someone!

- 0of 0 votes
You are designing the client side of a Survey website. Provide the list of classes and methods you will use to break the problem down. Also, provide the API interaction with server.

- 0of 0 votes
http://www.geeksforgeeks.org/find-water-in-a-glass/

- 3of 3 votes
Find the minimum of every sub-array of size k in an array of size n.

O(n) solution required.

- 0of 0 votes
http://www.geeksforgeeks.org/find-water-in-a-glass/

- 1of 1 vote
Find the minimum of every sub-array of size k in an array of size n.

O(n) solution required.

- 0of 0 votes
Searching for a string in a DOM tree. A complete working solution was required. Assume you have any string matching algorithm available.

(Based on Ctrl+F search in chrome)

- 0of 0 votes
Searching for a string in a DOM tree. A complete working solution was required. Assume you have any string matching algorithm available.

(Based on Ctrl+F search in chrome)

- 1of 1 vote
Given a directed graph G, duplicate the graph using minimum space.

- 0of 0 votes
Design a rules engine. It should run in at least linear time and should efficiently handle repetitive attributes in different rules. E.g.,

Attributes:

1. Digit check

2. Character check

Rule:

1. Rule 1 - input should be digit

2. Rule 2 - input should be digit and = 3

3. Rule 3 - input should be digit and between 2 and 5

4. Rule 4 - input should be character and value should be 'A'

5. Rule 5 - input should be character and value should be 'B'

Design rule matrix and process a stream of inputs. More than one rule may be applicable for a given input.

- 0of 0 votes
How to find total number of greater number after all number in an array ?

Eg. Given array is,

5 3 9 8 2 6

o/p

3 3 0 0 1 0

- 0of 0 votes
User uploaded file in File container/storage --> Its parsed by 1 App and removed frim storage --> App having logs --> App stored data into database

--> One User interface featching data from DB havinig fields Username, Report ID, ProductID --> This UserInterface also connected to Report Application.

ProductID came from file, ReportID generated in report.

User interface not showing any data so what could be the issue?

- 0of 0 votes
Program- Metrics- Find Kth position in metrics in N X N metrics in spiral form

- 0of 0 votes
"aabcbcbdcc" you can remove and shuffle characters, find the maximum length of string which forms palindrome.

like "ccabdbacc"

- 0of 0 votes
5. Search functionality not working in Amazon shopping application in smartphone but its working through website, how you will debug this?

- 0of 0 votes
4. Generate Test data for below function Grade(Obtained marks, Total marks) having below grading system.

0% to 40%= D grade

41% to 60%= C grade

61% to 80%= B grade

81% to 100%= A grade

Grading calculation=Grade(20,40)=100*(20/40)= C grade