Software Developer Interview Questions
- 0of 0 votes
AnswersConsider a game similar to tennis. The game can be palyed by 'N' number of players. The player has to win atleast 'M' games to win a set.
- kumar June 05, 2018 in United States
Print all the possible combination of winning set for all the payers.
Where
2 <= N
1 <= M
For Example if [A, B] are the players and
if M = 2 The player has to win atleast '2' games to win a set.
The output will be
A A
A B A
B A A
B B
B A B
A B B
if M = 3 The player has to win atleast '3' games to win a set.
The output will be
A A A
A B A A
A A B A
B A A A
B B B
B A B B
B B A B
A B B B
Write an algorithm to print all the possible combination of winning set for all the payers| Report Duplicate | Flag | PURGE
Oracle Software Developer - 0of 0 votes
AnswersFind Duplicate number from a huge amount of data which cannot fit in the memory.
- CodeNinja June 03, 2018 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm - 0of 0 votes
AnswersFind kth-largest number from a huge amount of data which cannot fit in the memory.
- CodeNinja June 03, 2018 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm - 0of 0 votes
AnswersHow you will design and make a website like Hackerrank? How you will measure and limit the running time and memory usage of the program.
- johnallen582 May 25, 2018 in India for AWS| Report Duplicate | Flag | PURGE
Amazon Software Developer System Design - 0of 0 votes
AnswersWrite a function that receives string with decimal number (i.e. all characters are decimal digits) and prints the sum of all possible substring-numbers, example:
- leonid.ge May 04, 2018 in UK
sum(“123”) = 123 + 12 + 23 + 1 + 2 + 3 = 167| Report Duplicate | Flag | PURGE
Credit Suisse Software Developer Algorithm - 0of 0 votes
AnswerGiven N number of Strings, generate all combination of these String's characters, these Strings must be N long, and must contain only one number of char from each string.
- sapadt May 04, 2018
example: "abc", "def", "ghi" --> adg, adh, adi, aeg ... cfg| Report Duplicate | Flag | PURGE
Morgan Stanley Software Developer Algorithm - 0of 0 votes
AnswersYou are given the length and time of occurrence of packet and Queues which process packets. Total processing time for a packet is equal to the length of packet plus the waiting time in queue. For eg lets say we have only one queue for now, and A packet of length 5 comes at t = 1, and another packet of length 4 comes at t = 3. Total processing time for first packet is 5( no waiting time as queue is empty at t = 1) and at t = 3, 2 units of first packet is processed and 3 units remaining so, for second packet 3 units will be waiting time in queue plus 4 units for its length. Total processing time for 2nd packet is 7 units. If there are multiple queues you can add new packet in any of the other queues. Given the time and length of all incoming packets, we need to find the minimum no. of queues required such that total processing time of each packet is less than 10 units. Maximum possible no. of queues are 5. If you require more than 5 queues print -1.
Test Cases Format: First Line contains the number N, the total no. of packets and N following line contains two numbers ti, li where li is length of packet coming at time = ti units.
Test case1:
2
2 7
5 8
Test Case 2:
3
1 3
2 3
3 5
Test Case 3:
3
1 5
2 4
3 8
Output:
Case1: 2
Case2: 1
Case3: 2
Consider the following time table of incoming packets:time packets-length 1 8 2 5 3 2 4 6
If you put the packet in queue with minimum time then this will lead to 3 queues:
- ak4017 April 25, 2018 in United States
t = 1:
q1: 8
t = 2:
q1: 7
q2: 5
t = 3:
q1: 6
q2: 4, 2
t = 4:
q1: 5
q2: 3, 2
q3: 6
But its output should be 2 queues:
1) 8 in queue 1
2) 5 in queue 2
3) 2 in queue 1
4) 6 in queue 2| Report Duplicate | Flag | PURGE
Samsung Software Developer Algorithm - 0of 0 votes
AnswersYou are given an array of strings. For example, ["AB", "BC", "FOO", "ZA", "BAZ"]
- thriver April 22, 2018 in United States
- Output strings where you can get from one to the other using any ROT transformation.
ROT_1(AB) = BC
ROT_1(BC) = CD
ROT_25(AB) = ZA
AB,BC you can go from one to the other using ROT_1
Input: list of strings
Output: strings where you can get from one to the other using any ROT transformation.
Example:
Input : ["AB", "BC", "FOO", "ZA", "BAZ"]
Output: [ [ab, bc] , [ab, za] ]
AB,BC because you can go from one to the other using ROT_1
AB,ZA because you can go from one to the other using ROT_25
Do not return FOO, BAZ you can’t get from one to the other.| Report Duplicate | Flag | PURGE
Google Software Developer - 0of 0 votes
AnswersGiven an array of elements print even and odd numbers out of it using 2 threads . even_thread and odd_thread.
- anaghakr89 April 19, 2018 in United States
int arr[] = {3,1 ,2, 5, 6, 7, 8, 10, 9};| Report Duplicate | Flag | PURGE
Qualcomm Software Developer - 1of 1 vote
AnswersInterleave list of lists in Java
- npkatre102 April 18, 2018 in United States
Example:
input = [[1,2,3], [9, 0], [5], [-4,-5,-2,-3,-1]];
output = [1,9,5,-4,2,0,-5,3,-2,-3,-1]| Report Duplicate | Flag | PURGE
Facebook Software Developer - 0of 0 votes
Answersgiven period and threshold, Assume there is a endless streaming events, each event occurs at timestamp "x". The question want you to write an API that return true if number of the events are over the threshold within the period around timestamp "x"
- ajay.raj April 08, 2018 in United States
Ex:
period = 3, threshold =2
getEvent(10) -> false
getEvent(12) -> false
getEvent(13) -> true [10,12,13]
getEvent(20) -> false
part one: event come in order
part two: event come without order| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswersGiven vector<int> nums, and pair<int, int> range. Find out how many continuous subsequences within this vector sum up the number within the range.
- ajay.raj April 08, 2018 in United States
Input: [1, 2, 3], [3,6]
Output: (4)
because [1,2,3], [1,2], [2,3], [3]| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswerEach have a (x,y) coordinate.
- ajay.raj April 08, 2018 in United States
Write an API that group three Googler together for lunch if they are close enough. Otherwise, throw them in un-schedule pool.
Distance formula = sqrt((x1-x2) ^2 + (y1-y2) ^2)
Given an int range;
Range: 2
Input | Output of API Un-schedule pool
0,0 -> [] [[0,0]]
1,0 -> [] [[0,0], [1,0]]
3,0 -> [] [[0,0], [1,0], [3,0]]
1,1-> [[0,0], [1,0], [1,1]] [[3,0]]| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswersGiven an vector<int> nums and an int target, you can change any element of the vector to positive or negative. How many uniquely different vector sum up to target?
- ajay.raj April 08, 2018 in United States
Input: [1,1,1], target = 2
[-1,1,1]
[1,-1,1]
[1,1,-1]
return (3)| Report Duplicate | Flag | PURGE
Amazon Software Developer - 2of 2 votes
AnswersGiven a string with alpha-numeric characters and parentheses, return a string with balanced parentheses by removing the fewest characters possible. You cannot add anything to the string.
- genaker April 05, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Software Developer - 2of 2 votes
AnswersGiven a collection of two dimensional points and a number k, return the k closest points to (0,0) by Euclidean distance.
- genaker April 05, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Software Developer - 0of 0 votes
AnswerA group of friends are tracking the miles per gallon for each of their cars. Each time one of them fills up their gas tank, they record the following in a file:
- aa3781@nyu.edu March 16, 2018 in United States
His or her name
The type of car they drove
How many miles driven since they last filled up
How many gallons purchased at this fill up
Date of the fill
Their data is formatted as a comma separate value (csv) file with the following format for each row:(#person,carName,milesDriven,gallonsFilled,fillupDate)
Miles are recorded as floating-point numbers and gallons as integers.
Please create a program that allows members of this group to determine the miles per gallon (MPG) of each of their cars during a specific time range. Note: person may have more than one so a time range query might need to output data for one or more cars. A skeleton class will be provided; your job will be to complete the program.
The principal function for querying MPG is of the form (the exact name, data types, etc., can be learned by inspecting the "solution" class in the skeleton code):
GetRangeMPG(PersonName, StartDate, EndDate)
Returns list of objects containing (CarName, MPG)
MPG is calculated as (total miles traveled during time period)/ (total gallons filled during time period.
The dates you receive in the query should be treated inclusively.| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersDesign a data structure which reads below block of text
- smartbobby2K February 15, 2018 in United States
*Status update1
**Joe is working on a bug
**Alice is on vacation
*StatusUpdate2
**Alex finished task1
and returns me an Object such that I can navigate the this nested text easily like this:
obj.children[0] - > returns "StatusUpdate"
obj.children[0].children[1] -> "Alice is on vacation"| Report Duplicate | Flag | PURGE
Microsoft Software Developer - 0of 0 votes
AnswersGiven a Tree where each node contains an attribute say color(R,G,B... etc). find subtree with maximum number of attributes.
- smartbobby2K February 15, 2018 in United States
Input:
G
/ \
B R
/ \ / \
B B R R
/ \ / \
B R R R
Output:
Input:
R
/ \
R R
\ / \
R R R| Report Duplicate | Flag | PURGE
Microsoft Software Developer Trees and Graphs - 2of 2 votes
AnswersPartition given string in such manner that i'th substring is sum of (i-1)'th and (i-2)'nd substring. If such partition not possible then return empty arrayList.
- nileshpatil1212 February 05, 2018 in India
eg.
1) given "1111223" then return ["1", "11", "12", "23"]
2) given "1111213" then return ["11", "1", "12", "13"]
3) given "11121114" then return []| Report Duplicate | Flag | PURGE
Amazon Software Developer - -3of 3 votes
AnswersModify the following code:
def GenerateGraph(data): d = {} g = Graph() for word in data: for i in range(len(word)): bucket = word[:i] + '_' + word[i+1:] if bucket in d: d[bucket].append(word) else: d[bucket] = [word] for v in d.keys(): for word1 in d[v]: for word2 in d[v]: if word1 != word2: g.addEdge(word1,word2) return g
The objective is to find all combination of words by changing one letter at a time and adding to the graph if word exists in the dictionary.
- newbiepython January 28, 2018 in United States
We need to rewrite a different logic for the above code.| Report Duplicate | Flag | PURGE
Google Software Developer Python - -1of 1 vote
AnswersGiven a list of characters, write a function to output a list of length of minimum non overlapping subsequences that can partition the input list.
- akira January 25, 2018 in United States
For example:
Input : [a,b,c]
Output: [1,1,1]
Explanation: There are no repeated characters.
Input : [a,b,c,a]
Output: [4]
Explanation: The 'a' is repeated so one subsequence is between a to last a.
Input : [a,b,c,b,a,e,b,a,d,f,g,d,f,i,f,k,l,m,n,m,l]
Output: [8,7,6]
Explanation: max length from 1st 'a' to last 'a' is 8.
1st 'f' to last is 6 adding d to it = 7
so on| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
Answersfrom robot movement tell final position of robot...
- kishanvadalia.vadalia January 09, 2018 in India
testcases:
"ULDLLUDL"
"UP 2xDOWN LEFT 4xRIGHT"| Report Duplicate | Flag | PURGE
Goldman Sachs Software Developer - 0of 0 votes
Answers"Implement a job scheduler which takes in a function `f` and an integer `n`, and calls `f` after `n` milliseconds."
- lkjhgfdsa December 10, 2017 in United States
That's it. :)| Report Duplicate | Flag | PURGE
Apple Software Developer - 0of 0 votes
AnswersIs Quicken Customer Service The Finest Customer Care?
- servicefortechhelp December 07, 2017 in United States| Report Duplicate | Flag | PURGE
BPD Software Developer - 0of 0 votes
AnswersIs Quicken Customer Service The Finest Customer Care?
- servicefortechhelp December 07, 2017 in United States| Report Duplicate | Flag | PURGE
BPD Software Developer - 1of 1 vote
AnswersThe time taken by ith person to complete a task is Ki minutes.
- viksvampire19 December 03, 2017 in India
A company wants to finish N tasks given K persons each if their given time. Find minimum time to complete N tasks using K persons. There is no waiting time between the tasks switching. Persons can start their tasks simultaneously.
For N=3 and K=2,
Input:
3 2
1
2
Output:
2
Explanation:
Person 1 will start task 1 at t=0. Person 2 will start task 2 at t=0.
At t=1, Person 1 will switch to 3rd task finishing its first task.
By the end of 2 minutes, all 3 tasks will be finished. So, minimum time taken is 3 minutes.| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswerGiven a string of size n consisting of 0s and/or 1s.you have to perform k queries and there are two types of queries possible.
- vejon December 02, 2017 in United States
"1"(without quotes): Print length of the longest substring with all '1'.
"2 X"(without quotes): where X is an Integer between 1 to n.In this query, you will change character at Xth position to '1' (it is possible that the character at ith position was already '1')
Input Format:
First Line of input contains n and k, where n is string length and k is the number of queries.
Next line contains a string of 0's and/or 1's of length n.
Each of next k lines contains query of any one type (i.e 1 or 2).
Output Format: For each query of type 1, print in new line the maximum size of subarray with all 1's.
Example Input:
5 7
00000
1
2 3
1
2 5
1
2 4
1
Example Output:
0
1
1
3| Report Duplicate | Flag | PURGE
Google Software Developer - 0of 0 votes
Answers3. Complete the following function-
- Anirudha November 30, 2017 in India
Node * alternateReverse( Node* head1, Node*head2){
// code goes here
}
Where ‘Node’ is the structure of a linked list node defined as:
struct Node{
int data;
struct Node *next;
};
alternateReverse() must remove the even number nodes from the linked list and append them to the end in reverse order. No extra space was allowed. It was for 5 marks.
Example:
Input-1->2->3->4->5->6
Output-1->3->5->6->4->2
Input-1->2->3->4->5->6->7->8->9
Output-1->3->5->7->9->8->6->4->2| Report Duplicate | Flag | PURGE
Microsoft Software Developer - 0of 0 votes
AnswersSuppose you have an input character stream (StreamReader) and you have a list of pattens like ABCAS, ASGKT. KHTSD etc. You need to read the stream one by one character and you need to keep count on number of each pattern found so far and when EOF occures just print all the patterns along with count.
- Hitesh November 16, 2017 in India
Example:
Input String: 011100010
Pattern 1: 011
Pattern 2: 010
Output:
011 => 1
010 => 1| Report Duplicate | Flag | PURGE
Freight Tiger Software Developer Algorithm
Open Chat in New Window