## Recent Interview Questions

- 1of 1 vote

AnswersThere is a 2D matrix of 0s and 1s that depicts the number of rooms that can be formed by a co-working space company like WeWork based on the values. 1 means open space for room and 0 means wall. We need to group as many 1s and possible to form the largest and minimum number of rooms.

- Jigisha Aryya December 25, 2019 in India

E.g.

Number of Rows = 5, Number of Columns = 5

00010

01110

01100

01101

00011

Output: 4

Input 2:

4

3

001

111

011

100

Output: 4| Report Duplicate | Flag | PURGE

unknown Backend Developer Algorithm - 1of 1 vote

AnswersA startup website has a lot of real-time traffic . I want to see the real-time view (refreshed every 1 min) of top 20 users by hit count within last 10 mins. Full distributed system, I have to resolve all the concurrency issues.

- acharyashailendra1 December 22, 2019 in India| Report Duplicate | Flag | PURGE

Amazon SDE-2 - 1of 1 vote

AnswersWhat to do when we are poor on coding

- shekharlevadi100 December 21, 2019 in India| Report Duplicate | Flag | PURGE

Accenture Software Engineer Coding - 1of 1 vote

AnswersClass A has two data members which are instances of class B and class C. Class B needs an instance of class C to be created. We have to create an instance of object A on stack like 'A objA' in main function. 'new' operator should not be used anywhere.no objects on the heap

- vijay8836 December 18, 2019 in United States| Report Duplicate | Flag | PURGE

Adobe Software Engineer C++ - 1of 1 vote

AnswerPlease have a look at the following pseudo-code. Please note that the syntax may be completely different from any of programming languages you know. More specifically, indentation does not matter in this code, ":=" denotes the substitution, "=" is the equal comparator, and the condition in FOR statement is boundary-inclusive.

- chiranjibparida123 December 17, 2019 in United States

========

Initial state of an array "a":

[[4, 2, 4, 2],

[4, NULL, 4, 2],

[2, NULL, 8, 2],

[16, NULL, 4, NULL]]

========

Main function:

FUNCTION foo()

FOR y := 0 to 3

FOR x := 0 to 3

IF a[x+1][y] != NULL

IF a[x+1][y] = a[x][y]

a[x][y] := a[x][y]*2

a[x+1][y] := NULL

END IF

IF a[x][y] = NULL

a[x][y] := a[x+1][y]

a[x+1][y] := NULL

END IF

END IF

END FOR

END FOR

END FUNCTION

What is the issue with the above code?

How would you fix it?| Report Duplicate | Flag | PURGE

- 2of 2 votes

AnswersA list of relation is given. We need to express the relation in a single line with the largest unit leftmost.

- accessdenied December 09, 2019 in United States

eg.

a = 10b

b=5c

c = 20a

e=20d

a=10b=25e=50c=500d| Report Duplicate | Flag | PURGE

Algorithm - 1of 1 vote

AnswerViews are not lifecycle aware that's true but what more? In modern development there is hardly any difference.

- kaustubh deshmukh December 01, 2019 in India| Report Duplicate | Flag | PURGE

Facebook Android Engineer Android - 2of 2 votes

AnswersGiven a list of 2d points, if any two points have distance(straight line) <= k , group them together. For example. [P1,P2,P3], P1 to P2 <=k, P2 to p3<=k, p1 to p3>k. they are still in the same group. (distance relationship is chainable ) ask how many groups can you find ? I can think of N^2 time complexity with union and find. but how to do better than that? maybe NlogN or O(N)?

- laoen November 30, 2019 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer Algorithm - 0of 0 votes

AnswersWrite a binary calculator for summing two strings. Could not use standard {{ bin }} method.

- ito ogami November 20, 2019 in United States| Report Duplicate | Flag | PURGE

Pinterest Software Developer Programming Skills - -1of 1 vote

Answersreverse an array for k distance.

- 786.senthil November 15, 2019 in United States

[2,3,1,5,4] and k =3

output : [2,3,1,5,4]

method

void reverse(int[] arr, k)

this method will only reverse the array

write another method which will sort the array by incorporating reverse method inside sort.

You must have to call reverse(arr,k) method to sort the array. You are not allowed to modify the reverse method| Report Duplicate | Flag | PURGE

Facebook Software Engineer - 0of 0 votes

AnswersTwo sum problem

- xyz November 14, 2019 in United States for Load Balancer| Report Duplicate | Flag | PURGE

Google Backend Developer - 1of 1 vote

AnswersPrepare test plan for a new feature of " deposit cheque via mobile app " which is added under menu tab.

- raghunath.e November 14, 2019 in United States| Report Duplicate | Flag | PURGE

Amazon Software Engineer in Test test - 2of 2 votes

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

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window