Coding Interview Questions
- 0of 0 votes
AnswersWrite a retry function, continue to fetch data until u have exhausted max entries. If it fails, continue to retry until retry's have been exhausted.
- pri9 February 16, 2019 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Coding - 0of 0 votes
AnswersGiven a directed graph and a node , find the shortest cycle in a graph with given node .
- saurabh January 23, 2019 in India| Report Duplicate | Flag | PURGE
Google Software Developer Coding - 0of 0 votes
AnswersHow to find out distinct ngrams from a email_alias.
- ashwini.padhy89 December 05, 2018 in India
For instance xyz@gmail.com here the email_alias is xyz.for xyz if we want to find bigram then function should have input the email_id,and the number of grams lets say 2.
Than it has to return the distinct count of ngrams present in the email_alias.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Coding - 0of 0 votes
AnswersIt was a online coding round on software provided by samsung itself.
- @nnonymous October 07, 2018 in India
Given a graph print either of the set of the vertices that are colored with the same color. And if the graph is not bipartite print “-1”. Test cases also included the cases when a graph is not connected.
Note: No STL or other library functions were allowed| Report Duplicate | Flag | PURGE
Samsung Software Engineer Coding - 0of 0 votes
Answersyou are given two arrays .You have to print minimum number of swap operation to perform so that the median of two arrays are equal. if not possible then print -1.
- 1x23xyz September 20, 2018 in India
link = https://www.hackerearth.com/practice/basic-programming/implementation/basics-of-implementation/practice-problems/algorithm/equal-median-8aba723b/| Report Duplicate | Flag | PURGE
Coding - 0of 0 votes
Answersprint hockey stick number in pascal triangle where row of triangle can be upto 30000 and length of stick can be upto 100.
- Randhir September 09, 2018 in India| Report Duplicate | Flag | PURGE
Wissen Technology Software Developer Coding Data Structures Dynamic Programming Java - 0of 0 votes
AnswersYou are given a set of functions:
int open_port(); opens a serial port and returns 0 if everything ok (or -1 if error) int read_port(char *buf, int buf_size) which reads data from a serial port and stores it to 'buf' of size 'buf_size' or blocks until the data is available and returns the number of bytes read (or -1 if error occurred) void close_port(); closes a serial port connection
Design a class:
class SerialConnection { public: using ByteHook = std::function<void(char)>; SerialConnection(ByteHook callback); .... };
which should read data from the serial port asynchronously and send it to the callback function ByteHook byte by byte (e.g., for decoding).
- pavel.em August 24, 2018 in United States
Note that if you don't call 'read_port' often enough, the underlying system buffer might get full and some bytes will get lost..
Which data structures / sync primitives you are going to use ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Coding - 0of 0 votes
AnswersA car has to be given on rent. Different people come and ask for it for interval [s,e] and offer some price p. To whom shall the car be given in order to earn maximum.
- Ankita August 22, 2018 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Coding - -1of 1 vote
Answerwrite a main program to take snapshots of VMs
- samayragoyal990 August 10, 2018 in United States
Input: List of VMs(vmId: String), list of SLAs -> there is one-to-one mapping from VM to SLA
class SLA {
int freq_in_mins;
}
vm1 -> sla1{30 mins}
vm2 -> sla2{60 mins}
Constraints:
1) You can use takeSnapshot(vmId: String) -> Synchronous - I/O
2) If you start a snapshot of VM(with sla1) at time t0 and if it finishes at time t1, then the next snapshot should be scheduled at t1+sla1.freq_in_mins
vm1 at 00:00 and vm2 at 00:00
00:10 and 00:15
vm1 -> 00:10 + 30 = 00:40| Report Duplicate | Flag | PURGE
Google SDE-3 Coding - 0of 0 votes
Answerswrite a class that 1) calculates the average of the stream, 2) provides an API read the average.
- samayragoyal990 August 10, 2018 in United States
Handle overflows as the numbers can be very large and not fit into double/long.| Report Duplicate | Flag | PURGE
Facebook SDE-3 Coding - 0of 0 votes
Answers
- don99492 July 16, 2018 in United StatesGiven a string “SELECT c1,… FROM (SELECT c2,… FROM (…) WHERE c2=v2,…) WHERE c1=v1,…”, format to the following by inserting "\n" and "\t": “SELECT c1,… FROM ( SELECT c2,… FROM ( … ) WHERE c2=v2,… ) WHERE c1=v1,…
| Report Duplicate | Flag | PURGE
Coding - 0of 0 votes
AnswerMulti -level cache system design with different storage in each level.
- ANONU June 22, 2018 in United States
Read Operation : – Minimum time to read a particular key from cache system. This should be followed by writing the key in all levels above it. Eg. if “key” is found at level ‘i’, add this key to cache present at 1 to i-1 level.
b. Write Operation: – Any write Operation should write in cache of all levels.
You can choose any algorithm for cache management like LRU, MRU.| Report Duplicate | Flag | PURGE
Google Java Developer Coding - 0of 0 votes
AnswersBecause Ethereum smart contracts are deployed publicly, anyone with the right tooling can read their contents.
- drew.sen.8288 June 17, 2018 in Canada
Furthermore, people can access any state the contract specifies. Knowing that people have access to your
validation code, how do you write the contract so that somebody *must solve the problem. (*it should be near
impossible or significantly computationally expensive to derive the answer from your contract code)| Report Duplicate | Flag | PURGE
DMG Blockchain Blockchain Developer Coding - 0of 0 votes
AnswersEthereum is a blockchain that can run arbitrary programs. Write an ethereum program (i.e. contract) that will send 0.1 ETH (a bounty) to the first person who gets the correct answer to the above "100-digit"
- drew.sen.8288 June 17, 2018 in Canada
question.| Report Duplicate | Flag | PURGE
DMG Blockchain Blockchain Developer Coding - 0of 0 votes
AnswersGiven a wall, which is made up of two types of bricks (Porus / opaque ). Porus bricks allow water pass through them. Opaque won't. Find whether water reaches to ground, if there is any rainfall.
- gopi.komanduri June 11, 2018 in India for Office
Water can flow from top to bottom, diagonally, horizontally as well. Only flowing from bottom to top is not possible.| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Algorithm Arrays Brain Storming Coding Data Structures Dynamic Programming Problem Solving Programming Skills - 1of 1 vote
AnswersGiven a string as input, return the list of all the patterns possible:
'1' : ['A', 'B', 'C'], '2' : ['D', 'E'], '12' : ['X'] '3' : ['P', 'Q']
Example if input is '123', then output should be [ADP, ADQ, AEP, AEQ, BDP, BDQ, BEP, BEQ, CDP, CDQ, CEP, CEQ, XP, XQ]
- ngupta32@hawk.iit.edu March 30, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm Coding Data Structures - 0of 0 votes
AnswerGiven a singly linked list, Your task is to remove every Kth node. The task is to complete a method deleteK that takes two argument, head of linked list and an integer k.The method returns the head of the new linked list. There are multiple test cases. For each test case, this method will be called individually.
- referthisfirst February 27, 2018 in India for Front End| Report Duplicate | Flag | PURGE
referthisfirst.com Site Manager Coding - -1of 1 vote
AnswersI am surprised by this GS question.I thought this is one of the classic number theory partition problem which is so hard that the best algorithm is approximation one.
- hprem991 February 22, 2018 in United States
Given value, find all possible combination of ways which equals to that sum.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer Coding - 1of 1 vote
AnswersGoogle Fucked up question.
- hprem991 February 21, 2018 in United States
Given a random list of appointments (Start Date , End Date). Find all the appointments that are colliding.
This pretty easy looking question screwed me up today.There are tons of edge cases, I couldn't complete em all and 45 minutes pass like 15 minutes while explaining and coding same time.| Report Duplicate | Flag | PURGE
Google Software Engineer Coding - 1of 1 vote
AnswersImagine a computer where you have no "/" (divide) operation. All other operations are implemented including addition, multiplication, binary shift etc. Implement function div(int a, int b) using available operators only.
- godzilla February 14, 2018 in United States for unknown| Report Duplicate | Flag | PURGE
Riot Gaming Software Engineer Coding - 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
AnswersN different couple go to cinema with 2N different seats. They take their place randomly. You could make swap operations. Write a code for given input what is the minimum number of swap operations for sitting all couples with their partners? Additionally, be sure that no one swaps more than 2 times.
- new December 07, 2017 in United States| Report Duplicate | Flag | PURGE
Google SDE1 Algorithm Arrays Coding Data Structures - 1of 1 vote
AnswersGiven an array of sorted integers and find the closest value to the given number. Array may contain duplicate values and negative numbers.
- Vijay November 17, 2017 in India
Example : Array : 2,5,6,7,8,8,9
Target number : 5
Output : 5
Target number : 11
Output : 9
Target Number : 4
Output : 5| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm Arrays Coding Data Structures - 0of 0 votes
AnswersWrite a function to convert a String of ip address to hex
- akira November 04, 2017 in United States
eg: ip is 197.27.11.11 = 0xC51BBB. The conversion to hex has to be done without pre-existing library function. like String.format() etc.| Report Duplicate | Flag | PURGE
Unity 3D Software Engineer / Developer Coding - 0of 0 votes
AnswersAn web service maintains logs (suppose there are multiple log files per day) of all ip address which has requested service. If there is a DOS attack on the server find all ip addresses that has sent more number of requests and block them. Can this be done without writing any function in higher programming language?
- akira November 04, 2017 in United States
What would the function look like if written in some language like C, Java etc?
Can this be done in Time optimized and space optimized manner?| Report Duplicate | Flag | PURGE
Unity 3D Software Engineer / Developer Coding - 0of 0 votes
AnswersYou are provided with 2D char array. You have to provide the 2D char array as response which contains the multiplication od the input array. For eg: input=> {{a,b},{c,d}}, output => {{a,c},{a,d},{b,c},{b,d}}
- gauravkumar1491 September 13, 2017 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Coding - -7of 7 votes
Answersaa
- Anonymous July 25, 2017 in United States| Report Duplicate | Flag | PURGE
Uber Senior Software Development Engineer Coding - 0of 0 votes
AnswersA company's organizational structure is represented as
- JustYourAverageDev July 14, 2017 in United States
1: 2, 3, 4
In the above employees with id 2, 3 and 4 report to 1
Assume the following hierarchy.
1: 2, 3, 4
3: 5, 6, 7
5: 8, 9, 10
Given an employee Id, return all the employees reporting to him directly or indirectly| Report Duplicate | Flag | PURGE
Bloomberg LP Senior Software Development Engineer Coding - 0of 0 votes
AnswersGiven a array of integers there is one that is repeated several time. How would you compute the length of the sequence of repeated elements.
- Fernando May 29, 2017
Assuming the initial array is sorted can you do better than O(n) both for spatial and temporal cost?| Report Duplicate | Flag | PURGE
unknown Software Engineer Coding - 0of 0 votes
AnswersImplement power function. The function should take two numbers as input (e.g. 2,3) and return 8 as output
- Syed May 22, 2017 in India
See link below for hints and answer https://baquerrizvinotes.blogspot.in/2017/05/how-to-crack-amazoncom-technical.html| Report Duplicate | Flag | PURGE
Amazon Software Engineer Coding
Open Chat in New Window