Sunday, October 5, 2014

Adobe Online Test

Sponsored by HackerRank

Aptitude Test: (Duration : 50 mins)

45 quantitative and analytical questions in 50 mins

Technical test: (Duration: 2hrs)

1. Given a boolean 2D array, where each array is sorted. Find the row with maximum no of 1s.

2. Each number which has 3 at its unit place has a multiple which has all 1s.
  Ex: 3 has 111,  13 has 11111
 Given a number, return the multiple which has all 1s.
http://ideone.com/0RQ8r3

3. Recursive multiplication: Multiply two integers without using multiplication , division , bitwise operator and loops.

4. Given a number, find whether it is palindrome or not.

5. Check for balanced parenthesis in an expression.

6. Write a function  with head node as parameter to reverse a linked list.

7. Given an array of integers and a sum s. Find if a pair exists in an array whose sum is equal to s.

Tuesday, September 16, 2014

Fiberlink Interview Questions

1. Given an array which has marks of n student. Write a program to find rank of a student , given the marks.

Solution:   http://ideone.com/YOjkTa

Sunday, September 14, 2014

Applied Material Interview Questions

1. Create a Pyramid to print in below order:
                              A
                           BCD
                         EFGHI
                       JKLMNOP
                   QRSTUVWXYZ


Solution:     http://ideone.com/ro9L39

2. Write a program to find square root of a number upto 2 decimal places.

Solution:    http://ideone.com/0g0Se1

3. Write a function to find second largest element in an array in O(n) time.

Solution:    http://ideone.com/RjN5Kj

4. Convert a Binary Tree to Singly Linked list in place using inorder traversal.

Solution:   http://ideone.com/79Gdye

Saturday, September 13, 2014

Paypal Interview Questions

Round 1:

1. 7 Balls puzzle.  1 ball is odd among 7. Find odd ball in minimum weighing.
2. Write a function to check whether a number is prime or not. Give more than one solution.
3. What are your strengths?
4. Why do u want to leave your current company?

Round 2:

1. Explain about semaphore including what happens exactly at OS level.
2. Asked what is the toughest programming problem I have solved recently.
3. What are your strengths?
4. Why do u want to leave your current company?

Round 3:

1. Asked to give output of few C++ program.
2. Explain about virtual constructor and  virtual destructor.
Why can't we have virtual constructor?
3. Hourglass Puzzle: We have two hourglasses . One measure 7 min and another 11 mins.
Find out how to measure 9 mins using two hourglasses.

4. Write any sorting algorithm and explain.
5. Puzzle again  :-P
A grid is given. Arrange 1 to 8 in that grid in such a way that no two consecutive numbers should be placed besides each other parrallely or diagonally.


Round 4:
1. Write a function to check whether two strings are anagram of each other or not.
2. Write a function to check whether two strings are rotation of each other or not.
Solution:  http://ideone.com/OJ1oWY

3. Write a function to find all permutation of strings.
Solution:  http://ideone.com/GNkDMa

4. An array A[] and sum s is given. Find subset in array for which sum is equal to s.
  Ex: A[]={1, 3, 11, 4};
    sum =8;
 subset is {1, 3, 4}





    

Airwatch Interview Questions

  Written Test:
(10 Programming +10 Aptitude questions)
 Programming:
1.  Write a function to check if two strings are anagram of each other or not.
2. Write a function to generate all permutation of number.
3. Write a function to print union and intersection of two arrays of numbers.
4. Write a function to randomize/shuffle array of elements.
5. Write a program to implement queue using two stacks.
6. There are two threads . One prints odd and another prints even. Write a program using these two threads to print numbers in sequence i.e: 1 2 3 4 5 6 7 8 9...

Solution: http://ideone.com/dBEBBR

7. Given an array A[], and a number x, find a pair in the array whose sum equals to x.

Aptitude:
1. A book has N pages numbered from 1 to N.  The total no of digits in the page numbers are 1095. Find no of pages.
2. Relationship between legs and heads of hen and cows. Find no of cow.
3. Lake Problem. In how many days patches of lilies will get halved if it gets doubled in 48 days.

Technical Interview:

1.  Explain abstraction and polymorphism through example.
2. Difference between a, &a, &&a if a is a pointer to an integer.
3. Why constructor cannot be virtual and destructor can be virtual.
4. Say a matrix is like below:
        1   2   3
        4   5   6
        7   8   9
print elements of right diagonal.
i.e  3
     5 6
     7 8 9

Solution: http://ideone.com/k5Qq6a










Thursday, September 11, 2014

Paypal: Write string in spiral prder

Write the code that will take a string, calculate the minimum square that
will contain it and return the converted string:
String convert(String text);
convert(“paypalisthefastersaferwaytosendmoney”) should return
“paypalferwaiamonyssdyettrnesohetsafe”

The string “paypal is the faster, safer way to send money” is written in a
clockwise spiral pattern inside a square starting from the upper left
corner:
(you may want to display this pattern in a fixed font for better legibility).
P A Y P A L
F E R W A I
A M O N Y S
S D Y E T T
R N E S O H
E T S A F E
Then read line after line:
PAYPALFERWAIAMONYSSDYETTRNESOHETSAFE

Wednesday, September 10, 2014

Brocade Interview

  Telephonic Round:
  Based on C and Data structure.
1. Write a program to check if a number is power of 2 or not
2. Write a program to set and unset a particular bit
3. Write a program to check endianness of a machine.
4. Write a program to generate nth Fibonacci number.
5. Calculate size of a structure. (Wanted to check concept of structure padding)
6. Write a program to check if a binary tree is BST or not.
7. Difference between Char a[] and char *a.
8. Write a program to find out non-repeating number in an array.

Saturday, September 6, 2014

Adobe Interview Questions

1.  C Program to check for Balanced parenthesis.

2. The digits of a number are coming from a stream one by one. At any point of time, tell whether the number formed by digits are multiple of 3 or not.

Solution:  http://ideone.com/MZdpfs

3. Given a binary tree and number, return true if tree has a root to leaf path such that adding up all the values along the path will give the number. Return false if no such path can be found.

Solution:  http://ideone.com/QCIG3G

Tuesday, September 2, 2014

Saturday, August 30, 2014

Friday, August 29, 2014

Adobe Interview: Find next larger element in the right side in an array

Write a program to replace each element of an array with a number present on the right side of the element such that the number is least greater than the element. If there is no greater number replace it with -1 

e.g : 8, 58, 71, 18, 31, 32, 63, 92, 43, 3, 91, 93, 25, 80, 28 
ans : 18, 63, 80, 25, 32, 43, 80, 93, 80, 25, 93, -1, 28, -1, -1 



Idea here is to create a BST with the elements in array starting from rightmost element in the array and keep track of left turn.
The last left turn node is the answer.

Here is the link:

http://ideone.com/UCfr8J

Monday, August 25, 2014

Optym Online Test: Shortest Palindrom

Given a string, Find minimum no of characters to be inserted to convert it to palindrome.
Input: ab
         aa
         abcd

Output:
     1 .  insertion to make it bab
     0   insertion to make it aa
     3   insertions to make it dcbabcd

Optym Online Test: Minimize the moves

You have a sequence of d[0] , d[1], d[2] , d[3] ,..,d[n]. In each move you are allowed to increase any d[i] by 1 or 2 or 5  i:0 to n .What is the minimum number of moves required to transform the sequence to permutation of [1,2,3,..,n] if it's possible else return -1. 
Constraint: 1<=n<=1000

Input:
First Line will have no of elemnts
Second Line on. elements will be present
Ex: 5
  1
1
3
2
1

Output:
As no of elements are 5, all permutation can be {1, 2, 3, 4, 5} .
To convert input to get all possible permutation i.e {1, 2, 5, 4, 3},
no of moves will be 4.

Hence output would be 4.

Optym Online Test: Complement of a number

Write a program to find complement of a number.

Ex: Input: 50
      Output: 13
 
   Input: 100
   Output: 27



Saturday, May 24, 2014