## Software Developer Interview Questions

- 2of 2 votes

Answers[redacted]

- tohhubeta September 02, 2016 in United States| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 1of 1 vote

AnswersGiven a sparse matrix, implement below two methods:

- starlord September 01, 2016 in United States

void set(int row, int col, int val) /*Update value at given row and col*/

int sum(int row, int col) /*give sum from top left corner to given row, col sub-matrix*/| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 1of 1 vote

AnswersA company is looking for algorithm to show item recommendations.

- maksymas August 29, 2016 in United States

If a customer bought A and B items and another buys A item, B should come as recommendations.

There are two types of recommendations based on the connections

1) Two items are strongly connected if a customer buys those items.

2) Two items are weakly connected if each items are strongly/weakly connected to another third item.

Provided the sample input

ABC

10

first:ABC

first:HIJ

sec:HIJ

sec:KLM

third:NOP

fourth:ABC

fourth:QRS

first:DEF

fifth:KLM

fifth:TUV

first, sec, third.. represents the customer names

ABC, HIJ... represents the item codes

For the Input item Id "ABC", since "ABC" is strongly connected to HIJ, DEF, QRS

and whereas ABC is weakly connected to KLM and TUV

the output should be count of strong and weak connection i.e., [3,2]| Report Duplicate | Flag | PURGE

Amazon Software Developer Algorithm - -5of 5 votes

Answersinterview would be easy. For freshers it would be okay

- magesh215 August 17, 2016 in India

for experienced no salary hike is available| Report Duplicate | Flag | PURGE

Nanosoft Technologies - Chennai Software Developer - 0of 2 votes

Answerpair programming example question with code for thoughworks interview

- rahulgoyal030 August 16, 2016 in India| Report Duplicate | Flag | PURGE

ThoughtWorks Software Developer C++ - -2of 2 votes

AnswersDesign unix file system in database.

- mohit.kum85 August 16, 2016 in United States| Report Duplicate | Flag | PURGE

Amazon Software Developer Database - 0of 0 votes

AnswersSuggest a data structure and implement efficient phrase search along with word search in a huge chunk of text.

- novicedhunnu August 14, 2016 in India for N/A| Report Duplicate | Flag | PURGE

Microsoft Software Developer Trees and Graphs - 2of 2 votes

AnswersThere are n+1 loading docks. a permutation of boxes 1->n is placed on the first n. there is a fork that can move one box to an empty location at a time. Give an algorithm to sort then boxes with minimum number of moves.

- ad09 August 05, 2016 in United States

Follow up: minimum distance| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 0of 0 votes

AnswersGiven a dictionary and a string, find all the substrings that are valid words in dictionary.

- Pedro July 28, 2016 in United States

I was thinking of a Trie solution but I'm not sure a Trie will work easily to match sub words that begin in the middle of the string.| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 0of 0 votes

AnswersGiven an array: 1,2,3 ,5,8,7,6,9,5,7,3,0,5

- sindhu1690 July 27, 2016 in United States

subarry:5,7

Find the subarray in the large array and return the minimum length and index where you can find the subarray. Note: that the subarray may be present in the large array non-contiguous.

In the above case : the answer is length = 2 and

index = 8| Report Duplicate | Flag | PURGE

Microsoft Software Developer Algorithm - 0of 0 votes

AnswersAn unsorted array is given . Find the no of greater elements on right side on current element in array. Find this for every element of array Expected time complexity is lesser then O(n^2)

- knocks July 24, 2016 in United States| Report Duplicate | Flag | PURGE

Amazon Software Developer Algorithm - 0of 0 votes

AnswersA monotonically increasing function F(X) exists. For a given no N , find the value of X when F(X) = N.

- knocks July 24, 2016 in India| Report Duplicate | Flag | PURGE

Amazon Software Developer Algorithm - 0of 0 votes

AnswersGiven a random function with equal probability of getting 1 or 0 ie 50% each. write a custom function which uses the above random function such that your function should return 1 with 75% probability and 0 with 25% probability

- coolcoder3 July 22, 2016 in India| Report Duplicate | Flag | PURGE

Oracle Software Developer Algorithm Problem Solving - 6of 6 votes

AnswersYou are given a matrix with N rows and N columns. Elements in matrix can be either 1 or 0. Each row and column of matrix is sorted in ascending order.

Find number of 0-s in the given matrix.

Example:`0 0 1 0 1 1 1 1 1 Answer: 3 0 0 0 0 Answer: 4`

Update: Expected complexity is O(log(N)). The best I've seen in comments is still O(N).

- emb June 26, 2016 in United States

Update2: Alright, guys, sorry for a bit of trolling. Obviously this is not possible to do faster than O(N). Here is why: take a diagonal (N, 1), (N-1, 2), ... (1, N). Suppose input matrix has all 0's above this diagonal and all 1's under this diagonal. So only diagonal elements vary. Clearly, diagonal elements do not depend on each other. So we have to analyze each diagonal element which is O(N).

Nice job, @gen-y-s :)| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 0of 0 votes

AnswerGiven M nodes and at most one outgoing edge from any node. Given Q operations where an operation is either

- lifeenergy999 June 19, 2016 in India

i) 1 Z where Z represent the source node, print the terminal node if a coin travels through edges. In case, if node Z lies in a cycle, print LOOP. 1 is the operation type

ii) 2 Z where Z represents node for which the outgoing edge is removed and 2 is operation type.

Operations are performed in order in which they are given.

M <= 3*10^5, Q <= 3*10^5

Input

First line contains integer M.

Second line contains M integers, where ith integer represents outgoing edge from ith node. If outgoing edge is 0, that means there is no outgoing edge from this node.

Third line contains integer Q followed by Q lines where each line is either 1 Z, or 2 Z where Z is node number. Nodes are 1-indexed.

This question was asked in coding test. Can somebody please help me with this problem with the given constraints?| Report Duplicate | Flag | PURGE

Software Developer Algorithm - 1of 1 vote

AnswersWrite a class to take in a large arbitrary number, also provide a function to increment the number. The number will be passed on as an array of integers.

- pushpinder2751 June 17, 2016 in United States| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 0of 0 votes

Answergiven an arraylist of say 50 lac entries and an empty queue, Design a multi-threading bases system which can copy the items in arraylist in a queue parallely

- avidwaj June 12, 2016 in India

How many threads can be spawned based on what criterion ? Basically the interviewer wanted to know how to implement an algorithm where we can design number of threads to be spawned ?| Report Duplicate | Flag | PURGE

Oracle Software Developer design - 0of 0 votes

AnswersWrite a program that takes an integer and prints out all ways to multiply smaller integers that equal the original number, without repeating sets of factors. In other words, if your output contains 4 * 3, you should not print out 3 * 4 again as that would be a repeating set. Note that this is not asking for prime factorization only. Also, you can assume that the input integers are reasonable in size; correctness is more important than efficiency.

- xankar June 07, 2016 in United States

Eg: PrintFactors(12) 12 * 1 6 * 2 4 * 3 3 * 2 * 2| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm - 0of 2 votes

AnswersA robot on a plane has 2 types of commands:

1. move forward by X units (X is integer 0 <= X <= 10000 )

2. rotate by X degrees (X is integer in range [-180, 180] )

A robot looks like`def robot(commands): while True: for command in commands: execute(command)`

Given a list of commands (of size <= 10000) tell if it's possible to build a wall around the robot such that he will never touch it.

Example:

- emb June 06, 2016 in United States`[move(10), rotate(180), move(10)] -> answer is yes [move(10), rotate(45), move(10), rotate(-45), move(10), rotate(45)] - answer is no`

| Report Duplicate | Flag | PURGE

Google Software Developer Brain Teasers - 2of 2 votes

AnswersYou are given a range [first, last], initially white. You need to paint it black.

For this purpose you have a set of triples

[(f, l, cost), ...] - where each triple means that you can paint range [f, l] for `cost` coins (limitations: cost is floating point >= 0, f, l, first, last are integers).

Find minimum cost needed to paint the whole range [first, last] or return -1 if it's impossible

Example:`[first, last] = [0, 5] and set of triples is [[0, 5, 10], [0, 4, 1], [0, 2,5], [2, 5, 1]]`

Clearly the answer is to take [0, 4, 1] and [2, 5, 1] - the total cost will be 2.

Another example:`[first, last] = [0, 5] triples are [[1,4, 10], [2, 5, 6]]`

answer is -1, because it's impossible to color whole range.

- emb June 05, 2016 in United States| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 3of 3 votes

AnswersGiven an array of length N and an integer K, sort the array as much as possible such that no element travels more than k positions to its left - an element however can travel as much as it likes to its right.

- testing@123 June 01, 2016 in United States| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 1of 1 vote

Answersgiven 2 strings A and B. generate all possible solutions when B is merged in A.

- JerryGoyal May 22, 2016 in India

Ex: A = "hey"

B: "sam"

then solutions are :

heysam,hseaym,hesaym,sahemy etc.

notice that order should be the same for both of strings while merging.| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 0of 0 votes

Answers/*

- xankar May 12, 2016 in United States

Prison cell question

In a kingdom there are prison cells (numbered 1 to P) built to form a straight line segment. Cells number i and i+1 are adjacent, and prisoners in adjacent cells are called "neighbors." A wall with a window separates adjacent cells, and neighbors can communicate through that window.

All prisoners live in peace until a prisoner is released. When that happens, the released prisoner's neighbors find out, and each communicates this to his other neighbor. That prisoner passes it on to his other neighbor, and so on until they reach a prisoner with no other neighbor (because he is in cell 1, or in cell P, or the other adjacent cell is empty). A prisoner who discovers that another prisoner has been released will angrily break everything in his cell, unless he is bribed with a gold coin. So, after releasing a prisoner in cell A, all prisoners housed on either side of cell A - until cell 1, cell P or an empty cell - need to be bribed.

Assume that each prison cell is initially occupied by exactly one prisoner, and that only one prisoner can be released per day. Given the list of Q prisoners to be released in Q days, find the minimum total number of gold coins needed as bribes if the prisoners may be released in any order.

Note that each bribe only has an effect for one day. If a prisoner who was bribed yesterday hears about another released prisoner today, then he needs to be bribed again.

Task: find the minimum amount of gold we need to bribe the prisoners so that the chosen prisoners can be released without causing cell destruction.

Input example:

8 cells, 1 prisoner has to be released. The prisoner to be released is the 3rd one.

|1|2|3|4|5|6|7|8|

7 gold coins

another example:

20 cells, 3 prisoners to be released: 3, 6 and 14

|1|2| |4|5| |7|8|9|10|11|12|13| |15|16|17|18|19|20|

release prisoner 3: 19 gold coins

release prisoner 6: 16 gold coins

release prisoner 14: 13 gold coins

release 14: 19 gold coins

release 6: 12 gold coins

release 3: 4 gold coins

input:

number of cells

prisoners that need to be released

output:

least number of gold coins we need to give

*/| Report Duplicate | Flag | PURGE

Amazon Software Developer Brain Teasers - 2of 2 votes

AnswersWrite a method to count the number of 2s between 0 and n.*

- xankar May 12, 2016 in United States| Report Duplicate | Flag | PURGE

Amazon Software Developer Coding - 0of 0 votes

AnswersDesign an algorithm to figure out if someone has won in a game of tic-tac-toe.

- xankar May 12, 2016 in United States| Report Duplicate | Flag | PURGE

Amazon Software Developer Coding - 0of 0 votes

AnswersDesign a hashMap in Java. Implement put, get, remove, resize methods.

- xankar May 10, 2016 in United States| Report Duplicate | Flag | PURGE

Uber Software Developer Algorithm - 0of 0 votes

Answers1) Narrate an instance you optimized or improved a software design.

- xankar May 10, 2016 in United States

2) Given a chance how would you re-think some of the design aspects?| Report Duplicate | Flag | PURGE

Uber Software Developer Behavioral - 0of 0 votes

AnswerDesign a Twitter feeds API. How would you actually connect it from a mobile? What happens behind the Twitter network? how do the Trends get published? From where does Twitter get the information for a particular trend(Eg: #Obama, #nfl) and publish it out? What protocol does it use? How do you connect to Twitter API? How does Twitter handle multiple connections?

- xankar May 10, 2016 in United States| Report Duplicate | Flag | PURGE

Uber Software Developer Software Design - 0of 0 votes

Answers1) Describe your most proudest project, least proudest project

- xankar May 10, 2016 in United States

2) Most inpiring teammate, what did he do?

3) Most awesome manager? Why was he so good?| Report Duplicate | Flag | PURGE

Uber Software Developer Behavioral

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

Open Chat in New Window