## Developer Program Engineer Interview Questions

- 1of 1 vote
You have given height array of array. Generate the original array.

Input: [6,3,0,2,2,0,0]

Output : [ 1,5,7,3,2,6,4]

A[i] value in input array is the number of greater element on right side.

- 0of 0 votes
How to print nested array ?

Input : [1, 5, 8, [9, 10, 24, 20, [39, 48], 89], 105, 99]

Output : 1, 5, 8, 9, 10, 24, 20, 39, 48, 89, 105, 99.

Which data structure you will use to store the values?

- 0of 0 votes
How you register one process with other process?

Eg: In c++ main is one process it has to create one process and then it forks other three process and each forked information should be registered with first forked process?

- 0of 0 votes
How to pass c++ objects from one process to other process ?

Eg: one process constructs C++ object with some data other process should receive this c++ object and display the data in it.

- -5of 5 votes
Fill the arrray with elements from 0 to 9.

based on thier frequency.

a[1]=3 means, 1 is repeated for 3 times(1 must present 3 times in that array)

a[2]=4 means 2 is repeated for 4 times.(2 must present twice in that array)

- 0of 0 votes
arista-networks-interview-questions

0

of 0 votes

0

Answers

Write findMin, findNext of BST tree node has parent and write PrintBST using above two

arista-networks-interview-questions

0

of 0 votes

0

Answers

Write findMin, findNext of BST tree node has parent pointer also.

void printBST(TreeNodep root) {

TreeNodep temp , next;

temp = findMin(root);

while (1) {

printf("%d",temp->value);

next = findNext(temp);

if (!next)

return;

printf("%d",next->value);

temp = next;

}

}

- 0of 0 votes
Write findMin, findNext of BST tree node has parent pointer also. http://www.geeksforgeeks.org/find-the-minimum-element-in-a-binary-search-tree/

http://www.geeksforgeeks.org/inorder-successor-in-binary-search-tree/

- 0of 0 votes
Given a array of integers {-6,-3,-1,2,4,5} which are sorted .Sort square of the numbers .Output {1,4,9,16,25,36}

- 0of 0 votes
A string has multiple spaces like "Fung ible is" .When ever there a space keep one space and remove all other spaces. output "Fung ible is"

- 0of 0 votes
Reverse Linked List

- 0of 0 votes
We have 52 week price list for a stock S. Suppose that during this period, we want to buy 100 stocks of S and sell all of them at a later day (within the 52 week window). We want to know when should we have bought and sold in order to make maximum profit. (If there is no profit making scenario, then it should be reported).

Example, for a small 4 week window: P1 = 14, P2 = 6, P3 = 7, P4 = 11 Then the output should be "Buy on 2 and sell on 4". Short selling is not allowed.

How can you best classify the type of the algorithm? (Greedy or Divide & Conquer or Dynamic Programming, etc..)

- 0of 0 votes
Given a list of stocks with their respective market capitalizations. The stock’s market cap are updated every minute based on its trading in the market. I have a strategy that wants a list of top 10 highest capped stocks in the market. This query can happen multiple times during the day.

Question: What would be the most appropriate data structure that can be used to efficiently implement the list of stocks? Discuss pros/cons of various data structures. Please briefly explain your answer.

- 1of 1 vote
fun(n){

if (n==0) return k;

else if n==1 return 1

else return 2*f(n-1)+4*f(n-2);

}

If fun(4) is 88, then what is the value of k.

- 1of 1 vote
Remove 3 consecutive duplicates from string.

INPUT:aabbbaccddddc

OUTPUT:cdc

- 1of 1 vote
We define an undirected graph g,such that: The total number of nodes in the graph is g_nodes. The nodes are numbered sequentially as 1,2,3….g_nodes. The total number og edges in the graph is g_edges. Each edge connect two distinct nodes(i.e no edge connect a node to itself). The weight of the edge connecting nodes g_to[i] and g_from[i] is g_weight[i]. We define the weight of the path from some start node to some end node to the sum of all edges traversed on the path. Input formate: The first line contain two space-seperated integer describing the respective value of g_node and g_edge. Each line I of the g_edge subsequent lines contain three space –seperated integer describing the respective value of g_to[i],g_from[i] and g_weight[i]. The next line contain an integer denoting start The next line contain an integer denoting end. The next line contain an integer denoting w_extra. input 1:

4 4

1 2 2

2 3 1

2 4 2

3 4 3

1

4

5

Output:4

input2:

5 5

1 2 2

1 4 4

2 3 1

3 4 3

4 5 1

1

4

2

output:3

Int mincost(int g_nodes,int g_edged,int* g_from,int* g_to,int* weight,int start,int end,int w_extra)

{

}

- 0of 0 votes
what would be the best way to reduce the size of image in E-commerce website having billions of images ?

- 0of 0 votes
I have a list with new obejcts added in it. How can I make sure that no one is able to modifiy my list?

- 0of 0 votes
We have a file which contains only strings with spaces and the size of the file is approx 10 gb. WAP in java to find the word and the count of word repeated most no of times

- 5of 5 votes
* Given an unsorted integer array, place all zeros to the end of the array without changing the sequence of non-zero

* elements. (i.e. [1,3,0,8,12, 0, 4, 0,7] --> [1,3,8,12,4,7,0,0,0])

- 0of 0 votes
* Implement a tick server the has multiple clients interested in different tickers. Clients have Plotters that are updated

* in real-time with the top 10 tickers that have the most price updates on the top. What data structure would you choose

* for the server and client plotters?

- 0of 0 votes
* Royal titles consist of name followed by space and a Roman numeral. Example: Richard IV. The Roman numeral in the title

* can go to L (50). You are given the roman numerals from 1 to 10:

* I II III IV V VI VII VIII IX X. And you are given the 10 multiples up to 50: XX XXX IL L. Numbers between 10 and 50 that

* are not given can be formed from 10 multiples and a numeral b/w 1 and 9. Example: 48 is XLVIII wichi is XL (40) plus

* VIII (8).

* <p>

* You are given an array of Roman titles sort it as follows: sort it on the name unless the names are equal, in which

* case you have to sort it on the ordinal of the numerals.

* Examples:

* Henry II, Edward VIII => Eward VII, Henry II

* Richard V, Richard II, Richard X => Richard II, Richard V, Richard X

- 0of 0 votes
a positive non reduceable fractions can be written has x/y where x,y are positive integers, find the count of non

reduceable fractions which is less than 1 for the given N where x,y <=N.

For example , if N=>4 then your output should be 5.

explanation : for N=4 the fractions can be formeted as fallows.

1/1,1/2,2/2,1/3,2/3,3/3,1/4,2/4,3/4,4/4

but 2/4 can be reduce to 1/2, also 1/1,2/2,3/3 and 4/4 is equal to 1, so we can elimi nate those fractions the list and we

have 5 non reduceable fractions whic is less than 1.

input : single number

out put : single number displayed the count of non reduceable fraction less than 1.

- 0of 0 votes
vTable will be created or not for abstract class. If yes then what will be the entry in this vTable

- -1of 1 vote
Implement % operator using bit mask.

- 0of 0 votes
Find the longest cycle in a directed graph in java

I/P -> 23 --> O/P 6

Elements : 4, 4, 1, 4, 13, 8, 8, 8, 0, 8, 14, 9, 15, 9, -1, 10, 15, 22, 22, 22, 2

longest cycle -> 4, 13, 11, 9, 8, 0

Its the value and value at that index.

- 0of 0 votes
Given N balloons, if you burst ith balloon you get Ai−1∗Ai+1 coins and then (i-1)th and (i+1)th balloons become adjacent. Find maximum number of coins you can gather.

If you have single balloon then you will get value written on it.

Example

if you have 4 balloons and coins associated for them are....

1 2 3 4 then you will get 20 maximum.

- -1of 3 votes
Construct a Binary tree from the preorder traversal and find the distance between two nodes.

- 1of 1 vote
A list L is too big to fit in memory. L is partially sorted. Partially sorted in a specific way: x-sorted L[i] < L[i+x]. Any element is at most x indices out of position.

You can look at the condition in a different way too..

L[i] >= L[i-x]

Sort the list L.

- -1of 1 vote
You are given an array of wooden log’s length. each of varying length.You have a wooden cutter with you. it has a sharpness value, say S.

You are supposed to cut as many wooden logs (desired logs), each of length L (not more or less) using only S cuts

if you cut a wood, S will decrease by 1

if you cut two woods together, even then S will decrease by the number of woods in the cut, ie. 2

assume L and S are int. and the length of each wood is also int

- 0of 0 votes
Given a matrix of ‘O’ and ‘X’, find the largest sub rectangle surrounded by ‘X’

Example :

XXXXX

X0X0X

XXXXX

XXXXX

Output : largest rectangle size is 4 x 5