Escolar Documentos
Profissional Documentos
Cultura Documentos
input: tejsinghrana
singhranadayal
output: singhrana
Q2. w.a. function to print the unique characters in a string.
input: asmnasnagmgsalna
output: asmngl
Q3. Given an array of strings and each string have only two characters
e.g.
srt = {ab, cd, al, ep, st, pm}
you have to print only those strings which have second character next
of the first character.
i.e. ab + cd + al = abcd
Q4 Find the longest string in a string, which have characters in contigious
form.
e.g. input: abcdkljklmnopqjrjgs
output: lmnopq
interview Questions:
1. print the sequence:
4444
4333
4322
4321
Q2. We have an array containing only 0 and 1.Sort the array
with complexity of O(n).
Q8. You are given two integers. You have to write a function to add their rever
sed equivalent
(i.e. the number with its digits reversed for ex 24 becomes 42) and return the r
everse of the sum.
Assume the reverse of 12 is 21 and not 210 or 2100
The prototype is: int AddReverse(int num1,int num2)
For example
Input : 24 35
Output : 59
Input: 227 872
Output: 1 ( And not 0001)
Input: 30 23
Output: 53 ( 3 + 32 = 35 so output 53)
Q9. print the sequence..
12345
23451
34512
45123
51234
Q 10. Find the longest common subsequence in two given string.
Q 11. Highest occurence of a character in a string and displaying it.
Q 12. We have some trees in a queue of given heights.We have to print only those
trees which
can be seen.
e.g. if we have trees of height in sequence 324165 then output will be 346
Q 13. Find the longest palandrom in a string
e.g. input: abfgerccdedccfgfer
output: ccdedcc
Q 14. Input a number and then find the next higher number such that for both the
number in
binarry representation contains equal number of 0s and 1s.
e.g. input: 3 ( 0000000000000011 )
output:5 ( 0000000000000101 )
Q 15. There are two sorted arrays a1 and a2 of sizw n1 and n2 respectively.
array a1 is full
array a2 has exactly n1 empty spaces.
write a function to merge these two arrays to form a sorted array without
any extra memory use.
Q 16. There is a matrix MxN. Its elements consist of either value equal to
0 or 1. If there is any zero in the row , then the output matrix should ha
ve all zeros in that row.
If there is any zero in any column then that column that column should
have all zeros in the output matrix. Find the function to perform
these operations.