Dev Lead Interview Questions
- 1of 1 vote
AnswersGiven an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.
- Nits January 30, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon Dev Lead - 0of 0 votes
AnswersHp printer support number
- pallmike9 August 28, 2018 in United States| Report Duplicate | Flag | PURGE
Dev Lead - 0of 0 votes
Answersset of locations on the map. Example, 4 places in zone 1. 2 places in zone2, 1 place in zone3 and 2 in zone4. 2 aircraft are assigned, A1, A2. A1 can fly faster. A2 is slower but farther than A1. Each day A1 can visit one location in any zone whereas A2 can visit 2 locations in any zone. what is the optimized number of visits by A1 and A2 at the end of 30 days.
- Geetha June 24, 2018 for Australia| Report Duplicate | Flag | PURGE
Capgemini Dev Lead Algorithm - 0of 0 votes
AnswersI was given this question recently in an interview.. There are three threads and a counter that will increase from 1 to 100. Catch is that thread 1 increments counter from 1 to 20. Thread 2 increments from 21 to 80. Thread 3 increments from 81 to 100.
- firefox December 11, 2017 in India| Report Duplicate | Flag | PURGE
Symantec Dev Lead Coding - 0of 0 votes
AnswerDesign and implement a multi-threaded application that finds the occurrence(s) of a string in a text file of 100GB. It should return the line-number(s) in which the match(es) is/are found.
- Venkata Pavan August 12, 2017 in India
Need not worry about the system constraints in spawning and running threads. There is a 32 core CPU with immense power. Huge amount of RAM.
The result should be returned in few sec.| Report Duplicate | Flag | PURGE
Scientific Games Dev Lead Threads - 0of 0 votes
AnswersAs an online retailer, design a price scraper service that determines the best prices at which products should be sold on the website.
- mesmerizing.memories89 May 08, 2017 in India
Should be able to check prices on competitor websites like Amazon, ebay etc. and suggest the best price in real time. Should be scaled to support price determination of 1 million products from 50k different sources.| Report Duplicate | Flag | PURGE
Boomerang Commerce Dev Lead - 0of 0 votes
AnswersDesign a system for implementation of stock market.
- jkjain.7884 February 17, 2017 in India
Buyer and seller case. stock server will receive buy request and sell request. A sell can be successful when it matches the quantity and price for same stock.
There will be many request for buyer and seller . Need to select the appropriate one.
Which data structure will be used ? how to handle concurrency issue?class diagram?| Report Duplicate | Flag | PURGE
Amazon Dev Lead System Design - -2of 2 votes
AnswersWrite code to traverse a NxM matrix in a zig-zag fashion
- LinkSausage January 03, 2017 in United States| Report Duplicate | Flag | PURGE
Google Dev Lead - -1of 1 vote
AnswersGiven a random string (reasonable length L), knowing all possible font sizes (e.g. font Fn has min_width, max_width, min_height, max_height), knowing fixed screen size, find the max font size that can display said string
- LinkSausage January 03, 2017 in United States| Report Duplicate | Flag | PURGE
Google Dev Lead - 0of 0 votes
AnswersImplement a2i - what are the edge cases you can think of? Signed integer only, subject to OS dependent MIN, MAX values
- LinkSausage January 03, 2017 in United States| Report Duplicate | Flag | PURGE
Google Dev Lead - 0of 0 votes
AnswersWe are given a book with N number of pages and two words. Find the distance(in pages) between the first occurrence of first word and first occurrence of second word. For Example, you are given the book "Thinking in C++" and two words 1. "Inheritance" whose first occurrence is in page 220 and 2. "Polymorphism" whose first occurrence is in page 350, the result would be 130. You can take your decision to choose how the data structure of the book would be.
- iamaniceboy16 November 05, 2016 in United States| Report Duplicate | Flag | PURGE
Bank of America Dev Lead Algorithm - 0of 0 votes
AnswerHi Implemented this sample code for N-ary postOrder Traversal.
- sunny346 October 11, 2016 in India
Now i want to throw error statement id the parent node is dependent on child.
Can some one help
package dependencyAlgorithm;
import java.util.*;
public class Dependency
{
class MainRule
{
String ruleName;
ArrayList<MainRule> subrule;
public MainRule(String name)
{
this.ruleName=name;
subrule=new ArrayList<>();
}
}
public static void postOrder(MainRule rootRule)
{
Stack<List<MainRule>> stack = new Stack<>();
MainRule rule = rootRule;
List<MainRule> list = null;
while (true)
{
if(rule != null)
{
list = rule.subrule;
for(int i=0;i<list.size();i++)
{
if(rule.ruleName == list.get(i).ruleName)
break;
}
rule = null;
if(list!=null && list.size()>0)
{
//push the list in the stack (do not modify original tree structure).
stack.push(new ArrayList<>(list));
//get first item from this list
rule = stack.peek().get(0);
System.out.print("\n1 ListSize: "+list.size());
}
}
else if (!stack.isEmpty())
{
System.out.print("\n2 \n");
list = stack.pop();
System.out.print("\n2 ListSize: "+list.size());
rule = list.remove(0); //shift left
System.out.print("\n2.1 ListSize: "+list.size());
System.out.print("\n"+rule.ruleName+" ");
rule = null;
if(list.size()>0)
{
System.out.print("\n3 ListSize "+list.size());
stack.push(list); //push back remaining list into stack
rule = stack.peek().get(0); //prepare for next iteration
}
}
else
break;
}
System.out.println(rootRule.ruleName);
}
/*
Fml001
/ | \
/ | \
/ | \
Fml002 C001_Base Tot001
/ / | \
/ / | \
Fml003 Fml004 R001_Base R001_TxPat
/
/
Tot002
\
\
C001_TxPat
*/
public void createBinaryTree()
{
MainRule rootRule;
MainRule Fml001 =new MainRule("Fml001");
MainRule Fml002=new MainRule("Fml002");
MainRule Fml003=new MainRule("Fml003");
MainRule Fml004=new MainRule("Fml004");
MainRule C001_Base=new MainRule("C001_Base");
MainRule R001_Base=new MainRule("R001_Base");
MainRule Tot001=new MainRule("Tot001");
MainRule Tot002 =new MainRule("Tot002");
MainRule R001_TxPat =new MainRule("R001_TxPat");
MainRule C001_TxPat =new MainRule("C001_TxPat");
rootRule=Fml001;
rootRule.subrule.add(Fml002);
rootRule.subrule.add(C001_Base);
rootRule.subrule.add(Tot001);
Fml002.subrule.add(Fml003);
C001_Base.subrule.add(Fml004);
C001_Base.subrule.add(R001_Base);
C001_Base.subrule.add(R001_TxPat);
R001_Base.subrule.add(Tot002);
Tot002.subrule.add(C001_TxPat);
postOrder(rootRule);
}
public static void main(String[] args)
{
Dependency dependency=new Dependency();
// Creating a tree structure
System.out.println("Path Traversed:");
dependency.createBinaryTree();
}
}| Report Duplicate | Flag | PURGE
Cognzant Technology Solutions Dev Lead Trees and Graphs - 0of 0 votes
Answersyou have millions of records in DB. How could you display those records efficiently as a paginated view. Which UI technology would you use and why? how will you design the back end?
- Anonymous July 26, 2016 in India| Report Duplicate | Flag | PURGE
deutsche bank Dev Lead design - 0of 0 votes
AnswersYou have a big .csv file (say the size is 3GB). How efficiently you can process it and put the records in database?
- Anonymous July 26, 2016 in India| Report Duplicate | Flag | PURGE
deutsche bank Dev Lead Java - 0of 0 votes
Answersis there a way to make the bean not initialize when spring application context coming up
- shin.subash March 03, 2016 in United States| Report Duplicate | Flag | PURGE
Cisco Systems Dev Lead - -2of 2 votes
AnswersInput
- mail.smohanty February 18, 2016 in India
2 5
2000
5000
Output
1000
Question: A real estate company plans to open relief distribution in few cities of a state.
The input in the first Line N(number of cities...2 as per example)
and M(Number of distribution center...5 as per example).
The next lines have the number of population in N(2) cities. (2000 and 5000) as per example.
Only people from a specific city can go to the distribution center of that city.
WAP to find the number of max people those can be accommodated in a distribution center.
The answer is 1000 in this case. As there are 7 distribution center.
First City having 2000 population will have 2 distribution center and second city having 5000 population will have 5 centers.
Therefore Max person that can be accommodated in a center is 1000.| Report Duplicate | Flag | PURGE
Hewlett Packard Dev Lead Algorithm - 0of 0 votes
AnswersGeneric Question: You have a list of items that's nearly sorted. What algorithm would you use to completely sort it? Even though it's already sorted, the least element could be at the other end ...eg: 4,5,6,7,8,9,10,11,1
- Engineer1111 January 24, 2016 in United States
She then said that what would be the approach if the data was not like that, as in , not so extreme.| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Algorithm - 0of 0 votes
Answershow to find all paths of a graph?
- KabhaD82 November 01, 2015 for RMCC
hi ,
i have a directed graph as an input and i want to find in that graph subGraphs that fit to some path
for example : i have the following graph 1[E] ->2[E] ->3[M]->4[E]->5[M]->6[M]->7[E]->8[M] .and i have the path E->M->E
then the program output should be the subGraph 2->3->4
note that the solution should be implemented as ADJ Matrix
the Graph is directed DAG
the program should be with C language| Report Duplicate | Flag | PURGE
Amazon Dev Lead C - 0of 0 votes
Answersthere are N employee sitting in consecutive cubicles , we have to send a few of them to onsite , but each time we send one employee onsite , his cubicle becomes empty , now the other employees from both side of that empty cubicle stops working until they are given a gift .
- ritwik_pandey September 11, 2015 in India
the gifts are given in both sides of the empty cubicle until we reach the end or found another cubicle ,
Input – number of cubicle , and index numbers of people to be sent
output- min number of gifts needed| Report Duplicate | Flag | PURGE
Accenture Dev Lead - 5of 5 votes
AnswersA plumber working for a company as a contractor. His job is attend services and submit the bill to get his salary on basis of daily work including his service charge 500 rupees. For a typical plumbing work he need pipes with different lengths. But in market he will get new pipe with standard size 100m of cost 100 rupees. (no small or large sized pipes available) Now , he need 10 , 40 , 60, 70 lengths of pipes for a jobwork.
- bhupal February 22, 2015 in India
Generally company gives him (4 pipes * 100 rupees) + 500rupees as service charge = 900 rupees.
but plumber bought only 2 pipes cut as follows and get his job done...
1st pipe => 40+60
2nd pipe => 10+70 + extra left(20)
By buying only 2 pipes he get his job done. remaining 2 pipes money saved.
write an efficient algorithm to calculate minimum number of standard size pipes required for given number of different pipes lengths:
Input:
N => total pipes for jobwork
arr[N] => lengths of pipes. (for simplicity, pipe size will be either smaller or equal to standard size)
outpud:
minimum statdard sized(100m) pipes required
constraint: you can only cut them can not join them back as follows
say he need 10 95 95,
with two pipes 100 100 = > 95+5 95+5 => 95 95 (5+5)// this is not accepted
EX:
Input:
5
20 30 50 60 80
output:
3
Input:
5
10 10 10 15 20 35 55 60 70 75 75 80
output:
6| Report Duplicate | Flag | PURGE
NVIDIA Dev Lead Algorithm - 1of 1 vote
AnswersPrint all subset of a given set which sums up to ZERO
- apurohit.in January 09, 2015 in India
{8,3,5,1,-4,-8}
so ans will be : {8,-8}
{3,5,-8}
{3,1,-4}
size of set can be upto 50 but elemet of set can be as big as 18 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersHi ,
- apurohit.in January 09, 2015 in India
Given a set of number eg {5,3,1,8, -8,-4}
Print all subset which will sum up to ZERO
for eg {3,1,-4} {5,3,-8}, {8,-8}
Note : size of subset can be max 100 and element can be very big like 13 or 14 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersI have used my personal google API key here, you can use that or generate your own.
- kumar.prince6 December 22, 2014 in United States
The response id JSON:
{
"destination_addresses" : [ "Sector 15, Faridabad, Haryana, India" ],
"origin_addresses" : [ "GBN School, Sector 21D, Faridabad, Haryana 121001, India" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "6.1 km",
"value" : 6054
},
"duration" : {
"text" : "12 mins",
"value" : 716
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
Base Algorithm or the rule engine for scheduling:
For the examples, let us assume pincode 121001, with 3 cabs cab1, cab2 & cab3.
The time slots are:
9:00 am to 10:30 am, 10:30 am to 12:00 pm, 12:00 pm to 1:30 pm, 2:30 pm to 4:00 pm, 4:00 pm to 5:30 pm and 5:30 pm to 7:00 pm
Non-real time scheduling
For an appointment of any time slot, say 4:00 pm to 5:30 pm, check the cabs allotted for adjacent slots, 2:30 pm to 4:00 pm and 5:30 pm to 7:00 pm for this example.
1) If no cabs are allotted for adjacent slots, then assign any random cab, say cab1.
2) Else, say cab2 is allotted to slot 2:30 pm to 4:00 pm and cab3 to 4:00 pm and 5:30 pm. Using google distance matrix api (referred to as gdm api from now on), find which cab is within x kms (x should be configurable, e.g 5 kms would be a good start) of the new appointment.
2.1) If one of the cabs is within x kms, assign it to this time slot.
2.2) If both cabs are within x kms, assign the one that is closer. If the difference is imperceptible, assign one randomly.
2.3) If both cabs are more than x kms, assign it to cab1
2.4) If cab1 was also allotted one of the adjacent time slots, then assign the nearest cab to this time slot. If the difference is imperceptible, assign one randomly.
Real time scheduling
This is applicable for appointments for the same day.
The same algorithm can be used, but use time to travel from the gdm api, instead of distance, since it accounts for traffic.
Feel free to discuss details or suggest changes in the rule engine.| Report Duplicate | Flag | PURGE
Dev Lead Dev Lead - 0of 0 votes
AnswersA seller sells lot of products in his store and people place orders,just like any other store. Each item has a different weight and price.
- Kittu November 22, 2014 in India
And each order can be a combination of different number of items with random quantity. Now each of these orders areto be put into different packages and sent to the courier company for delivery.
But there are certain rules while splitting items into packages, they are as below:
1. If the cost of all the items in an order is more than $1000, split those items into multiple
packages, otherwise one package would be enough.
2. If the items in the same order are split into multiple packages, then the weight of the
packages should be equally distributed over the packages with consideration of optimum
courier charges.
3. While splitting, NO PACKAGE can have a total price above $1000| Report Duplicate | Flag | PURGE
ADP Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersGiven two string you need to tell whether edit distance between two string is 1 or not.
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersTwo sorted array of integer are given, you need to find nth rank element from combine array.
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersThere is a set of n bolts and n nuts given. You have only API that tells whether given nut is smaller or larger then for a bolt no any other relative number. You need to match all nuts and bolts in O(nlogn).
- anurag321423 November 19, 2014 in India| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersGiven an abstract class A having a function sumBill(int a, int b). Now assume that you have 3 or 4 class extending class A and implementing their version of sumBill. And in various locations in the code you are making calls to sumBill with integer parameters.
- blaks November 19, 2014 in India
Later on it is identified that the parameters need to be of type double rather than int. So now one has to go refactor all the places which make a call to sumBill to pass parameters of double data type.
So the question is what could the developer had done better to avoid such a problem in the first place.
Its a design pattern question.| Report Duplicate | Flag | PURGE
CrimsonLogic Dev Lead Dev Lead Object Oriented Design - 0of 0 votes
Answersclass template vs template class?
- shailendra.rajput November 13, 2014 in India
c++ specific properties?
struct vs class?
encapsulation vs abstraction?
Design a holder - bulbs(LED,Normal,Tube light) - uml relation ship?
multiple inheritance, multiple level inheritance-CTOR and DTOR order for base classes ?
why use templates?
what is abstract class?
unit testing tools used?
smart poiner vs dangling pointer
why we take "Base& obj" as input in Base Copy CTOR function, in Base(Base& obj){}, why not "Base obj".
shallow copy vs Deep copy.| Report Duplicate | Flag | PURGE
Dover Organization Dev Lead Dev Lead C++