## Recent Interview Questions

- 0of 0 votes
You are given an array of both negative and positive integers. You need to rearrange the array such that positive and negative numbers alternate. Also, the order should be same as previous array and only O(1) auxiliary space can be used and time complexity boundation O(n).

eg. -2 3 4 5 -1 -6 7 9 1

result – 3 -2 4 -1 5 -6 7 9 1.

- 0of 0 votes
In a programming language,we have a conditional statement like "a ? b : c",(you can assume all the expressions here could be represented by single character).The task is to generate a syntax tree like this.

a

b c

Here are more examples of the input and output,

a ? (b ? c : d) : e

a

b e

c d

a ? b : (c ? d :e)

a

b c

d e

- 0of 0 votes
You have been given a 2D array of char and a String as input. Return a string consisting of the chars in the input string which are not present in the 2D array.

- 0of 0 votes
Given a binary tree where all the right nodes are leaf nodes, flip it upside down and turn it into a tree with left leaf nodes.

Keep in mind: ALL RIGHT NODES IN ORIGINAL TREE ARE LEAF NODE.`/* for example, turn these: * * 1 1 * / \ / \ * 2 3 2 3 * / \ * 4 5 * / \ * 6 7 * * into these: * * 1 1 * / / * 2---3 2---3 * / * 4---5 * / * 6---7 * * where 6 is the new root node for the left tree, and 2 for the right tree. * oriented correctly: * * 6 2 * / \ / \ * 7 4 3 1 * / \ * 5 2 * / \ * 3 1 */`

- 0of 0 votes
Print a tree in Level Order with a newline after each depth

`/** * Sample input: * * 1 * / \ * 3 5 * / \ \ * 2 4 7 * / \ * 9 8 * * Expected output: * 1 * 3 5 * 2 4 7 * 9 8 * ========== */`

- 0of 0 votes
How to split a string using spaces with a given condition, the string inside quotes (") will not be split.

- 0of 0 votes
we have website having several web-pages. And also there are lot many user who are accessing the web-site.

say user 1 has access pattern : x->y->z->a->b->c->d->e->f

user 2 has access pattern : z->a->b->c->d

user 3 has access pattern : y->z->a->b->c->d

user 4 has access pattern : a->b->c->d

and list goes on for lot many users which are finite and numbered.

Now the question is we have to determine the top 3 most occurring k-Page-sequence.

for the above example result will be : (k=3) a->b->c , b->c->d , z->a->b.

- 0of 0 votes
Given a string array and a pattern, find the number of occurrences

i.e. given`int[] a = new int[]{12, 789, 567, 1, 2};`

Find out how many times a pattern like 12789 occurs. You can do "12" and "789" one time and also "1" "2" and "789" to make the pattern as well.

- 0of 0 votes
Estimate the number of USPS boxes (i.e. ones at home address and NOT P.O. Boxes) in the U.S. You are not given USPS data, of course.

- 0of 0 votes
Q2 : You have been given an array of int as input. Return the number of times the digit 1 appears in the array.

count1s({2,11,5,199,4,7}) = 3 (twice in 11 and once in 199)

count1s({234,-11,-105,23841,101010,705}) = 7 (twice in -11, once in -105, once in 23841 and thrice in 101010)

- 0of 0 votes
K largest elements from a big file or array.

- 0of 0 votes
If we're given a project budget and limit of completion that is 6 months, then which approach is good, requirements capture, req analysis through modelling, detailed analysis or feasibility analysis?

- 0of 0 votes
Can any one help with sample coding questions for Adobe for Bigdata/hadoop position?

- 1of 1 vote
Write a code to test whether string s2 is obtained by rotating the string s1 by 2 places.

e.g S1="amazon" S2="azonam" return true

S1="quality" S2="lityqua" return false

- 0of 0 votes
Write a code to find duplicate elements in array and total count of duplicate elements.

eg. arr={5,3,4,6,7,5,3,2,1}

Duplicate elements:- 5,3

Total duplicate count:- 2

- 0of 0 votes
Write the test data for the function which takes input value as floating number and precision. It returns the output by rounding the value nearest to precision value.

e.g roundOff(3.4567,2) output will be 3.55

- 0of 0 votes
How will you debug the issue when trying to sync the contacts of smartphone with PC and all the contacts does not sync.

- 0of 0 votes
Write the test scenarios and test cases for PC based phot o preview software when the camera is connected to PC using USB.

- 0of 0 votes
Find first index of string s2 , If any anagram of a string s1 is exist in another string s2 ?

e.g. s1 abcd

s2 abcdefcdbacd

output should be 0 ,5, 6,7 .

- 0of 0 votes
Design software system for a multiplex assuming database server is available - List requirements, DB tables design, APIs. Follow up question how to integrate with third party ticketing systems? how to pass seats availability to ticketing systems?

- 0of 0 votes
Given an array of heights of poles. Find the no of poles which are visible if you are standing at the ith pole

- 0of 0 votes
Given 2 set of arrays of size N(sorted +ve integers ) find the median of the resultant array of size 2N.

(dont even think of sorting the two arrays in a third array , though u can sort them. Try something better than order NLogN

- 0of 0 votes
A game is being played with the following rules :

- The first player says 1, the next 2 and so on.

- If a number is a multiple of 4 or 7 then that number is skipped and the next number is spoken. However if the number is a multiple of both 4 and 7 then the number is not skipped.

Define a function which taken a number n as input and returns the nth number which will be spoken.

nthNumber(10) = 15 (the order of numbers spoken is 1,2,3,5,6,9,10,11,13,15)

- -1of 1 vote
Why is returning pointer to a node in linked list from a pointer is unsafe and sometimes gives wrong answers.

- 0of 0 votes
Given an array of strings as input, return an array of all strings that have repeated chars that appear together. For e.g. in "hello" l and in "summer" s is a repeated char that appears together. However in "robot" o is not a repeated char as it does not appear together.

repeatChars({"hello","robot","summer","elephant"}) = {"hello","summer"}

- 1of 1 vote
1 represent A, 2 rep B etc and 26 rep Z. Given a number, find number of possible decoding for this number. No need to consider number starts with zero. Eg: input – 1234, output – 3(ABCD, AWD, LCD)

- 0of 0 votes
Most efficient way to check whether a number is Prime or not.

- 0of 0 votes
`struct node { int data; struct node* left; struct node* right; }; void Postorder(struct node* root,struct node** leaf) { if (root == NULL) return; if(root->data%2==0) *leaf->left=root; //WHY I'M GETTING PROBLEM IN THIS LINE //[Error] request for member 'left' in '* leaf', which is of non-class type 'node*' Postorder(root->left,leaf); Postorder(root->right,leaf); } int main() { struct node *root = newNode(1); root->left = newNode(2); root->right = newNode(3); struct node* leaf=root; Postorder(root,&leaf); getchar(); return 0;`

}

- -3of 3 votes
Write a method to return first five 10 digit prime numbers

- 1of 1 vote
Write a method to return first five 10 digit prime numbers.