Recent Interview Questions
- 1of 1 vote
AnswersWrite a function to return string when passed integer . Note : do not use tostring() in built function.
- raghunath.e November 14, 2019 in United States
E.g 123 --> "123"| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test technical - 0of 0 votes
Answerswrite a program for recognize the string (a/b)*abb
- 12345dpatel12345 November 12, 2019| Report Duplicate | Flag | PURGE
Compiler - 0of 0 votes
AnswersA new senior trader has been invited to a gathering of traders from all around London. She goes there and tries to meet as many traders as she can. When she meets someone she generally remembers them by the market sector they deal in.
- jaryya@hawk.iit.edu November 12, 2019 in India
36 traders deal in the fx market.
32 traders deal in the derivative market.
39 traders deal in the crude oil market.
37 traders deal in only one market.
8 traders deal in all the three markets.
All traders deal in atleast one of the three markets.
Number of traders who deal in both derivative and crude oil but not fx was one less than the number of traders who deal in both fx and derivative but not crude oil.
The sum of the number of traders who deal in both fx and crude oil but not in derivative and in both crude oil and derivative but not fx was two greater than twice the number of traders who deal in both fx and derivative but not crude oil.
How many traders deal in both fx and crude oil but not derivative?
Find someone who has solved the first half of their collaboration question and ask them for the solution they got. You both have to solve the below question together and then come to us with your solution.
Let x be your result and y be the result for your partner
Then, P = (10* x/2)+ floor(y/4). Use p as an input to the next question.
According to the recent report published by the Human Resource team at a FinTech startup, the number of employees is 500 at present. They have been divided into four teams, named Technology, Operations, Management and Legal.
The report also tells that out of these employees, P% are campus recruits while the remaining have prior work experience. The number of employees in each team can be no less than 50 and no more than 175.
The following partially filled table shows the information about the break-up of the employees in terms of campus recruits or with work experience in the four teams.
Team Campus Recruit Work Experience
Technology 55% -
Operations - 45%
Management 55% -
Legal m% n%
What can be said about the relative values of ‘m’ and ‘n’?
a. m>n b. m<n c. m>=n d. m<=n| Report Duplicate | Flag | PURGE
Goldman Sachs Analyst - 0of 0 votes
AnswersWas asked at the Grace Hopper Celebration India (Bangalore) career fair at the GS booth.
- jaryya@hawk.iit.edu November 12, 2019 in India
How many golf balls are going to fit in the Boeing manufacturing warehouse?
My response:
Estimation problem, volume of the warehouse is approx 13.5*10^5 m^3 and vol. of each golf ball is 4/3*3.14*0.002^3 The space between every 8 golf balls is ~ equal to 1 golf ball...| Report Duplicate | Flag | PURGE
Goldman Sachs Analyst - 2of 2 votes
AnswerWas asked at GHCI Bangalore at their booth for a prize and perhaps hiring interns or experienced software developers.
- jaryya@hawk.iit.edu November 10, 2019 in India
Find the return value for N=100
int returnAns(int N){
int ans=0;
for(int i=0; i<N; i++){
for(int j=i+1; j<N; j++){
ans +=((i & -i) == (j & -j)?1:0); //the question missed the condition and was returning a boolean, so I added it myself
}
}
return ans;
}
My answer: 0 ; their answer: 1610, hence got it wrong.
My explanation: I assumed negative of i in binary to be
simply represented by setting the MSB to 1 e.g. for 8 bit representation of 3: +3 is 0000 0011 and -3 is 1000 0011. In the inner loop the value of ans will always evaluate to 0 since Bitwise & of these i and -i or j and -j will always result into i and j respectively. (undergrad computer organization concept.)
Negative numbers can also be represented as 1s and 2's complement and in all modern machines by architecture its 2s complement.
Now if we assume 1's complement, +3: 0000 0011 and -3: 1111 1100. so bitwise & of these two is 0 and so the value of ans will always be incremented by 1. By two loops 100+99+98+97+...+1 = 100*101/2 (i.e. n*(n+1)/2)
Then 2's complement, which is the most relevant representation of signed binary numbers.
Odd numbers:
+3: 0000 0011 -3: 1111 1101 Binary & is 0000 0001.
For all even numbers:
+4: 0000 0100 and -4: 1111 1011+0000 0001 = 1111 1100 and Bitwise & of 4 and -4 is 0000 0100 which is 4.
So, in the innermost loop ans is incremented by 1 when i is odd and j is also odd. ie. when i is 1, 3, 5, 7... 97 and j is 3, 5, 7, 9,...,99 ans is added 1(return value of true ==) when calculated it comes to 1610.| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 0 votes
Answersten years ago, Delhi Metro started its operation by opening the first line in central Delhi. The government received enormous response from various sections of society of Delhi. People started using Metro services so often that only after 6 months all the train coaches filled tightly by the travelers. After 10 years now, Metro expanded so much that now it covers almost all the major areas of the city. Today around 6 different lines are running in different areas which are connecting not only Delhi but also other NCR regions to Delhi. Lakhs of people using Metro service every day and today it becomes one of the top 10 well known Metro networks all over the world. For this new line, Metro Planning team found various localities where metro stations can be built and they identified various Localities around Delhi where commercial agreements are established. Goods were traded between localities via road that had a commercial agreement. It is possible to connect any two localities by a line segment in the city.
- narendrakumarveeranki November 08, 2019 in India for 0| Report Duplicate | Flag | PURGE
Capgemini freshers - 0of 0 votes
Answers - Anonymous October 31, 2019 in United States| Report Duplicate | Flag | PURGE
Blockchain Developer - 0of 0 votes
AnswersThere are N cars parked in a row in a parking lot of the newly constructed club. as it is demonstrated in the picture below.
- shivanandtripathi02 October 27, 2019 in India
There is a gasoline and diesel fueling station installed.at the left and right side of the park.
An automatic fueling robot carries the fuel from station and fill up the parked car with fuel.
The cars are divided into 2 types depending on whether it is a gasoline or diesel car.
1 is denoted as gasoline cars and 2 is denoted as diesel cars.
The automatic robot will be used to provide a cost free fueling service which is filling up
all cars with 1 litre of each corresponding fuel.
The robot will move in between the 2 fuelling stations as below :
1) The robot carries 2 litre of gasoline at the gasoline station and starts moving from there.
2) The robot can fill up the cars of the same type of gas it carries 1 litre each.
3) The robot can go back to the fuelling station at any time, Independent from the current amount of fuel it carries.
4) When the robot arrives at the fuelling station, it gets 2 litre of supply of the corresponding fuel.(If the robot has some remaining fuel it will be discarded).
the picture is not there. so, i will explain how the arrary must look like. suppose the arrary is arr od
size x. then at index = 0, there is gas station and at index = x - 1 there is dielsel station. Remaining all indexes are filled with vehicle type. 1 represents gas type and 2 represents diesel type.| Report Duplicate | Flag | PURGE
Samsung SDE1 .Net/C# - 1of 1 vote
AnswersI was asked this during my onsite google interview but was unable to come up with an optimization for it. Here is the question:
- Jaysun October 26, 2019 in United States
There's a list of (x,y) points and a method getCircle with the following signature:
/**
* Given three points returns a circle (Radius, and center) such that all three points lie in its circumference
* or it returns null if no such circle is possible.
*/
Circle getCircle(point1, point2, point3);
getCircle method is already implemented and given to you as a black box. The problems asks you to find the Circle with most points in its perimeter.
The obvious answer is to get all possible triplets of points and find all possible circles and keep track of which one appears most often O(n^3) . Any ideas on how to further optimize this?| Report Duplicate | Flag | PURGE
Google SDE-2 Algorithm - 1of 1 vote
AnswersYou have a table :
- mukesh.scorp October 23, 2019 in United States
Rule1 Rule2 Rule3 Value
A1 B2 C3 40
A1 B1 C1 20
A2 B2 C2 10
A1 B1 C1 40
* B1 * 20
A5 B2 * 10
Now if I have a condition A1 && B2 && C3 i will get output as 40.
If I input A1 && B1 && C1 I will get two results 40 and 20 here there the rule is ambiguous.
"-" in table means any rule, 5th row matches with any row with B1 as rule2, so there is also ambiguity in result.
Now given that table as input (m * n) where n is number of available rules combination (here its 6) and m rules (3 in this case) , output if the table is ambiguous i.e it will output two different result for same query.| Report Duplicate | Flag | PURGE
Google Backend Developer Algorithm - 1of 1 vote
AnswersFind the two elements that have the smallest difference in a given array.
- si October 23, 2019 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Arrays - 0of 0 votes
AnswersWrite an iterator class to traverse the tree
- si October 23, 2019 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Trees and Graphs - 0of 0 votes
AnswersHow to traverse a tree?
- si October 23, 2019 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Trees and Graphs - -2of 2 votes
AnswersGiving a the following:
- xi.text.xi October 22, 2019 in United States for none
A list of a store items T={t_1, t_2,...,t_n}.
A list of prices of each item P={p_1, p_2,...,p_n}.
A list of quantities of each item Q={q_1, q_2,...,q_n}, respectively.
And total bill M.
Our goal is to find any possible list of items that its total value is equal to M using dynamic problem.
Write down a recursive solution.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersGiven an array of positive and negative integers {-1,6,9,-4,-10,-9,8,8,4} (repetition allowed) sort the array in a way such that the starting from a positive number, the elements should be arranged as one positive and one negative element maintaining insertion order. First element should be starting from positive integer and the resultant array should look like {6,-1,9,-4,8,-10,8,-9,4}
- sameerasusmitha October 21, 2019 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Arrays - 1of 1 vote
AnswerDesign a service to scan photos/videos for any malware
- novastorm123 October 16, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon System Design - 0of 0 votes
AnswersDesign APIs around, storing into and retrieving from, an Amazon Warehouse locker.
- novastorm123 October 16, 2019 in United States
- Each item will fully occupy one Amazon locker
- Always keep track of how many remaining lockers are available after each API call| Report Duplicate | Flag | PURGE
- 1of 1 vote
AnswersAmazon has N buildings on the site, building ID ranged from 0 to N-1
- arpita.tanvi21 October 13, 2019 in United States
Every employee has an office space in one of the buildings.
Now employee may make a request to move from current building X to
another building Y. A moving request is noted by
Class Request{
String employee names;
int from building;
int to building;
}
Initially all buildings are full. A request from building X to building Y is
achievable only if someone in building Y made an achievable requests to
move away and therefore creates a vacancy
Given a wishlist of requests, help us plan for the best way of building
swaps. A plan that fulfill the maximum number requests is considered
the best
Output is a list of employee names on cyclic swaps.
For Ex:
Input :
List<Request requests{
<"Alex" 1, 2>,
<"Ben", 2, 1>,
<"Chris", 1, 2>,
<"David", 2, 3>,
<"Ellen", 3, 1>,
<"Frank", 4, 5>
}
Expected Output:
List<List>
[ ["Alex","Ben"],["Chris","David","Ellen"] ]
Can someone please help me how to solve this one?| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersSuppose two arrays are given A and B. A consists of integers and the second one consists of 0 and 1.
- AN October 11, 2019 in India
Now a operation is given - You can choose any adjacent bits in array B and you can toggle these two bits ( for example - 00->11, 01->10, 10->01, 11->00) and you can perform this operation any number of times.
The output should be the sum of A[0]*B[0]+A[1]*B[1]+....+A[N-1]*B[N-1] such that the sum is maximum
During the interview, my approach to this problem was to get the maximum number of 1's in array B in order to maximize the sum.
So to do that , I first calculated the total number of 1's in O(n) time in B. Let count = No. Of 1's=x
Then I started traversing the array and toggle only if count becomes greater than x or based on the elements of array A(for example : Let B[i]=0 and B[i+1]=1 & A[i]=51 and A[i+1]=50
So I will toggle B[i] B[i+1] because A[i]>A[i+1])
But the interviewer was not quite satisfied with my approach and was asking me further to develop a less time complex algorithm.
Can anyone suggest a better approach with lesser time complexity??| Report Duplicate | Flag | PURGE
Software Developer Algorithm - 0of 0 votes
AnswersWrite a method that merges a fixed number of streams containing an infinite sequence of monotonically increasing integers into an output stream of monotonically increasing integers. It is important to note that the input stream are infinite, so any solution based on the length of the streams would be considered incorrect.
Note that the question was given in the context of Java with the below code given as the base contract for the method.public void merge(List<Stream> inputStreams, Stream outputStream) { // Implement me }
This was also provided as the definition of "Stream" in this case, and not what is defined in java.util.stream.Stream.
- gr1ml0ck October 05, 2019 in United Statesinterface Stream { // Retrieves but does not remove the next item from the stream int peek(); // Retrieves and removes the next item from the stream. int poll(); // Puts an item into the stream void put(int i); }
| Report Duplicate | Flag | PURGE
Amazon Solutions Engineer Algorithm - 0of 0 votes
AnswersDesign a data structure for json objects. Json objects consist of key:value pairs. And here the value can be int, array or another json object.
- anonymous October 05, 2019 in India| Report Duplicate | Flag | PURGE
Adobe - 0of 0 votes
AnswersWrite test cases for earring with diamond, gold clamp, diameter 13mm, width 4mm
- roman.khomitsky19 October 05, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance - -1of 1 vote
AnswersGiven a set of horizontal and vertical line segments, find the number of squares formed by them?
- uj.us October 04, 2019 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersImplement union and intersection of two array(in a efficient way).
- dhruvjoshi43 October 04, 2019 in india for none
Additional information given by the interviewer was: elements of the two given array may be repeated but cannot be repeated in union and intersection array.| Report Duplicate | Flag | PURGE
Amazon Data Engineer test - 1of 1 vote
Answersfind nearest word from the given non-english dictionary which is one off character. (could be non ascii characters)
- prathji October 01, 2019 in United States
for eg. dictionary contains { apple, pineapple, banana, orange }
if given word "applx" then return true, as applx matches with apple and only one character is off.
aplpe returns false| Report Duplicate | Flag | PURGE
Google Software Developer - 0of 0 votes
AnswerGiven a square (n x n) matrix which only contains 0 and
- danishm026 September 29, 2019 in India
1. Find the minimum cost to reach from left most column to rightmost column.
Constraints/rules:
a. Starting point: You can start from any cell in the left most column i.e. (i, 0) where i can be between 0 and n( number of rows/ columns)
b. Destination: You can reach any cell in the rightmost column i. e ( k, n) where k can be anything between 0 and n.
c. You cannot visit a cell marked with 0.
d. Cost is defined as the sum of cells visited in path.
e. You can move up, down, left and right but not diagonally.
For example,
take 2x2 matrix
1 | 0
1 | 1
One possible path is 00 -- 10 -- 11 with cost 3
Other one is 10 -- 11 with cost 2
so minimum cost on this case is 2.| Report Duplicate | Flag | PURGE
unknown Random Algorithm Data Structures - 0of 0 votes
AnswersWhat is the next number in the series 16,24,54,115
- sowmyapadi4444 September 23, 2019 in United States| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersWhat is the next number in the series 76,24,54,115
- sowmyapadi4444 September 23, 2019 in United States| Report Duplicate | Flag | PURGE
Open Chat in New Window