## Developer Program Engineer Interview Questions

- -1of 1 vote
consider a battlefield to be made up of square cells of unit dimensions. a soldier on the battlefield can move from a cell to all(8) of it's neighboring cells. soldier has a gun with with him which he can shoot the targets up to any distance along any of the 8 possible directions (north,east,west,south,north-east,north- west,south- east,south- west). also some sell are bulletproof which prevents bullets to pass but soldier can walk over them as if it were a normal cell.he can destroy the target from a bulletproof cell but not from a cell behind it.

position of a target/ soldier can be given by the cell, they are on.given the position of the target, starting position of a target and position of all the bullet proof cells. you have to tell the position of closest shooting point i.e the cell from which, the soldier can shoot the target and is closest to the starting position of the soldier. if there are more than such cells, output all of them.

Input/output specifications :

Input specifications :

I) size of the battlefield { integer pair (N,M) : battlefield will be of N*M size )

II) staring position of the soldier {integer pair (i,j)}

III) position of the target {integer pair (x,y) : position of the cell on which target is mounted}

IV) position of the all bullet proof cells { list of integer pair a#b : each element in the list is a position of bullet proof cells }

output specifications :

sequential list of integer pair i#j (cell) that are closest shoot points and must fallow row wise traversal.

Note: if the output list contains four shoot points : (2,1), (1,2), (3,2), (2,4) on a 4x4 battle field.

then the correct output will be {1#2,2#1,2#4,3#2} not {1#2,2#1,3#2,2#4}

Examples:

Input : {2,2} {2,1} {2,2} {1#1,1#2}

output : 2#1

below is the method signature in java:

public static String[] nearest_shoot_point(int[] input1,int[] input2,int[] input3String[] input4){

}

- 0of 0 votes
Given a 2 dimensional point of a rectangle and its area, find permutations of all the other 3 points of the rectangle in 2-D space.

Ex:- Given X=(0,0) and A=1

(0,1),(1,0),(1,1)

(0,-1),(-1,0),(-1,-1)

- 0of 0 votes
glitch is a walking robort moves in a peculiar problem: it takes x steps forward , then x+1 steps backward, then 2x steps forward, x+2 steps backward,3x steps forward x+3 steps backward , and so on... until it has taken y steps,glitch turns 180 degrees before continuning with its pattern . write a program that prompts x and y and total number of steps taken and outputs how many steps away from its starting point

- 0of 0 votes
Given a password in number : Write an algorithm to print all possible combinations of that password.

Hint: - Try to go from all possible combinations of lower bound to the valid upper bounds

- 0of 0 votes
Basket ball hit rates The hit rate of the basketball game is given by the number of hits divided by the number of chances. For example, you have 73 chances but hit 15 times,

then your hit rate is 15/73=0.205 (keep the last 3 digits). On average, you have 4.5 chances in each basketball game. Assume the total number of games is 162. Write a function for a basketball player. He will input the number of hits he has made, the number of chances he had, and the number of remaining games. The function should return the number of future hits,

so that he can refresh his hit rate to 0.45

- 0of 0 votes
get a string(word) from user, then make every possible permutation words.

Ex)intput: tree => output : tree, rtee, rete, reet, etre, eetr, eert, eter, eret, teer, reet..

- 0of 0 votes
security code takes numbers but one key is allowed to be faulty, other numbers should be same in sequence ex 124 is accepted if actual number is 126 46..

- 0of 0 votes
you can go to a fast food restaurant to buy chicken nuggets in 6-pack, 9-pack or 20-packs. is there such a number N, such that for all numbers bigger than or equal to N, you can buy that number of chicken nuggets?

- 0of 0 votes
This is on Additive Number Property

Additive Number examples:

123459 (1+2=3, 4+5=9)

314538 (3+1=4, 5+3=8)

122436 (12+24=36)

You are given a range, you need to print all the additive numbers.

- 0of 0 votes
Simplify the implementation below as much as you can.

Even better if you can also improve performance as part of the simplification!

FYI: This code is over 35 lines and over 300 tokens, but it can be written in

5 lines and in less than 60 tokens.

קוד: בחר הכל

static int func(String s, char a, char b)

{

if (s.isEmpty()) return -1;

char[] strArray = string.toCharArray();

int i=0;

int aIndex=0;

int bIndex=0;

while (aIndex=0 && bIndex==0 && i<strArray.length)

{

if (strArray[i] == a)

aIndex=i;

if (strArray[i] == b)

bIndex=i;

i++;

}

if (aIndex != 0)

{

if (bIndex == 0)

return aIndex;

else

return Math.min(a, b);

}

else

{

if (bIndex != 0)

return bIndex;

else

return -1;

}

}

- 0of 0 votes
Given 1 byte. Write a function that checks that it have exactly 3 bits which equal to 1.

- 0of 2 votes
I needed to develop next system:

We have a lot of servers. Every server generate logs. Every log has two data types: first is numeric metrics. These numeric metrics are integer. Second is strings. We need to collect logs from all servers on other server (storage). Then we have to execute queries and get some data from storage. In our queries we have to use numeric metrics and strings as well. For numerics metrics we have to be able get aggregation data as well.

Develop Storage server, database. Describe how will you scale this system, what database will you use, how will you save data and how will you execute this queries.

- 0of 0 votes
C program given two strings and print common character from both:

Input: bangalore

mysore

output: ore

- 1of 1 vote
Graph problem:

Critical node: If a node reaches another node only through one node.

Eg: A-C-B and A-E-B are critical nodes. (A reach B through one node which is C or E)

If A reaches B through more than one node, then they are not critical nodes.

1) A-C-B

A-D-E-B (A reach B thro C which might lead to critical node but A has another path to B thro D and E, so they are not critical nodes).

2) X-Y-Z

X-A-Z (X and Z are critical nodes)

Now find all critical nodes.

- 0of 0 votes
I have a 4 simple thread T1, T2, T3, T4, is there any way we can find out which thread will execute first each time.

- 0of 0 votes
Mr. Xhas recently shut down his factory and wants to sell off his metal rods to a local businessman. Mr. Octopus has many rods whose length are represented by array - lengths = {lengths[0], lengths[1], lengths[2], ...}.

The local businessman will only pay for rods that have same length. Let's say Mr. Octopus plans to sell rods of lengthL only. Then he had to cut each rod 0 or more time, so that he can maximize the profit. The remaining rods whose length is not L will be thrown away. Price of N rods of length L will be N × L × unit_price. Also note that for each cut made to a rod, he had to pay cut_cost.

What is the maximum amount of money Mr. Octopus can make? You have to complete the function int maxProfit(int cut_cost, int unit_price, int[] lengths).

Constraints

• lengths will contain between 1 to 50 elements, inclusive.

• Each element of lengths will lie in range [1, 10,000].

• 1 ≤ unit_price, cut_cost ≤ 1,000.

Sample Input #1:

cut_cost = 1

unit_price = 10

lengths = [26, 103, 59]

Sample Output #1:

1770

- 1of 1 vote
How do you design system for identifying groups of contacts in phone. Basic info like mail Id, name are different but the person representing them is same. looking for a deduplication way to identify.

- 0of 0 votes
How hashmaps are implemented internally, Write data structure definition, one more java question on Equality check for String Pools, String object references.

- 0of 0 votes
Implement method to print left view of binary tree.

- 0of 0 votes
From a web page, each logged in user can click on a plus icon and enter key-value pairs. There is restriction on the entered key and values. Design a schema to store the enter the key-value pairs entered by each user, such that given a key we should be able to retrieve all the username who entered that particular key.

- 0of 0 votes
IEEE float to IBM float value conversion

- 1of 1 vote
3> write program to find wrong no of "(()" parenthesis in expression "((B+a)"

give error for "((A))" - for unnecessary brackets

- 0of 0 votes
2> write program to mirror the binary tree.

- 1of 1 vote
1> write program to calculate power(x,n) in log(n) time

- 2of 2 votes
To deploy a module inside kernel, what are the possible methods.? Mention actual difference among them.

- 0of 0 votes
You to find the shortest palindrome string by adding 0 or more characters on the right side of the string.

for example:

string is java then answer would be avajava

string is enm then mnemn

string is aavaa then aavaa

- 0of 0 votes
How to implement your own Hashmap?

- -1of 1 vote
You have infinite number of 3Rs coins and 5Rs coins. And your are provided one random number and u need to find out that whether you can make the amount with both denominations.

for example:

U r given a number: 23 then 5*4 +3 = 23 so true

U r given a number :16 then False.

- 0of 0 votes
You have a string and you need to find the shortest palindrome string from that string by adding 0 or more characters on right side of the string.

example:

String is java then answer would be avajava

String is emme then emme

String is hcasach

- 0of 0 votes
How to implement your own HashMap??

How to handle the collision using some chaining technique?