Sei sulla pagina 1di 4

WAP

WAP
WAP
WAP
WAP

to
to
to
to
to

reverse a string
remove repeated occurrence of a character from string.
reverse the matrix.
find loop in a link list
find duplicate in a file

Reverse a link list. Design a data structure for a seminar room.


write algorithm on some CPU scheduling related question
33
1 written , 2 technical interview rounds , 1 hr round and 1 managerial round. Wr
itten mostly on pointers for freshers. Technical rounds on operating System-CPU
Scheduling and basic algorithm questions. Some easy puzzles were also asked.
find max subarray among array of _ve and -ve elements
Puzzle questions are asked.Problems like to find no. of barbers in city etc. can
be asked..
Asked to write a C code for counting words , lines , in a file Asked few SQL que
ries and detailed description of project
Write a program to print 1 to n with one in sequence with one thread printing ev
en numbers and second thread printing odd numbers.
Write a java program to print numbers from 1 to 10 using 2 threads. Thread 1 sho
uld print odd and thread 2 should print Even numbers.
Write a program to find duplicate elements in an array In O(n) time using O(1) e
xtra step.
Write a function which will return a char from a given encoded string from given
index without decoding string. e.g. from a2bc3d4 ( means aabcbcbcdddd ) and index v
alue is 7 means function should return c without decoding original string ?
find out
ay whose
,2 5 -7,
s sum is

the subset of an array of continuous positive numbers from a larger arr


sum of of the elements is larger in comparision to other subset. eg: {1
2 5} .The two subarrays are {1,2,5} {2,5} and the ans is {1,2, 5} as it
larger than{2,5}

Given two classes C1 and C2 which are almost same.(remember not exactly same).
You want to choose best among these classes so that it can be use as key in hash
map.
Question 1: Given an array with n elements consisting of numbers between 1 to n1 with some numbers being repeated multiple times in the array.
Give a result[] array as output containing all the repeated/duplicate elements.
Given an array containing a sequence of numbers , you need to identify whether t
hat sequence is Fibonacci , Arithmetic Expression or Geometric Expression
============ And give it s next term as output.
Sorting words in a large file
pseudo code for detect a loop in linked list and remove it.

1. Find out
array whose
{1,2 5 -7,
its sum is

the subset of an array of continuous positive numbers from a larger


sum of of the elements is larger in comparision to other subset. eg:
2 5} .The two subarrays are {1,2,5} {2,5} and the ans is {1,2, 5} as
larger than{2,5}

You have a 8*8 chess board and given a starting and final location of a knight.F
ind the shortest possible path for the knight.
Given a stream of around billion numbers in an array, which has approximately on
ly 1000 unique numbers. Print the unique numbers. Complexity should be less than
O(n).
Eg:
Input: 1,1,1,1, .2,2,2, 3,4,4,4,4 1111,1111, ..
Output : 1,2,3,4,1111
Write a program to print the frequency of all words in a given paragraph.
Write a program to reverse the string word wise.
Write a program to explain producer consumer program using threads.
(Only theory) What data structures will you use to design a garbage collector.
Given a linked list with next and arbitrary pointers, clone it.
Reverse a linked list in groups of n.
Vertical level order traversal of a tree.
Reverse the second half of the linked list in the most efficient way.
Q3: Find the merging point of two linked list.
Q4: Write a function to generate all possible n pairs of balanced parentheses.
For example, if n=1{}
for n=2
{}{}
{{}}
1. Find minimum cost path in a Matrix i.e. return the minimum cost path to reach
(m, n) from (0, 0). Each cell of the matrix represents a cost to traverse throu
gh that cell. It was based on DP.
2. Simple question based on logic.
3. Based on hashing or you can use map in C++. You have given two sentence A and
B. Find the length of smallest substring in A that contains all characters of B
.
1. Merging two linked list . They asked me to write code on paper for merging bo
th sorted and unsorted linked list.
2.Add two numbers recursively. I was asked to write the whole code.
3.Factorial of large number only concept. Then asked one puzzle and one or two q
uestions from my project.
1. Which data structures will you prefer to make a new language. After that a lo

ng discussion took place.


2. Find the frequency of each word for a given set of huge data.
3. External Sorting concept.
Final was to explain Segment tree and its complexity which was asked from my pro
ject. Then general discussion on BST and he asked complexity of AVL and RB tree.

1.
A prisoner broke out from jail. In order to escape, he will have to jump
n no. of walls and length of each wall is given. Maximum height to which prison
er can jump is given. Now since it was a rainy day all the walls are wet and whe
n prisoner makes a jump he slips down l units. Calculate total no. of jumps he w
ill have to make in order to escape. (Simple logical question)
2.
Find smallest substring which contains all characters from a given strin
g?
Input string1: This is a test string
Input string2: tist
Output: t stri
3.
Given a maze. Drop a mouse in the maze randomly, and place a piece of ch
eese in any cell. The mouse can move 4 directions
up down left right
There are some walls on the way to block certain directions for certain position
.
Design an algorithm for the mouse to find the cheese.
Note: the mouse does not know where he is, and where the cheese is. He cannot fi
nd x,y for the position he is right now.
for instance
X X B
D X D
A X X
D is the block with walls on 4 sides.
If the mouse reaches the end of row or column, it gets the dead end.
Mouse is A, cheese is B. Return true if mouse can reach the cheese else return f
alse.
A brief intro of yourself and discussion on my projects.
Then he asked me about my fav. subject and language (DS and C++).
Questions on OOPS (almost all the concepts were covered like polymorphism, overr
iding, overloading, inheritance, concept of virtual fxns etc.)
He wrote a C++ code and asked me to write the output.
Some questions on DS and then he asked me to write algo for reversing a linked l
ist.
Then he asked me to explain one of the questions that I had attempted in the cod
ing round. (They just want to make sure that you know the logic).
Round 4: (Technical Interview)
Topics in DS that I am comfortable with and the ones with which I am not.

Unfortunately this time he asked me questions from the later. They don t want a co
rrect answer but just want to see how you approach in such questions.
Questions from bit-wise operators
Then he asked me to explain other one of the two questions I had attempted in co
ding round.

Potrebbero piacerti anche