Software Engineer / Developer Interview Questions
- 1of 1 vote
AnswersDesign a class for converting integer to Roman numerals.
- CoderLonely May 24, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersGiven an array of n elements return true if 3 of the sum of 3 elements is equal to a constant c
- mapardotl April 10, 2018 in United States for Facebook groups
Example array a[6,2,3,4] constant c = 9
if a[1] + [2] + [3] == c return true
The size of the array is n
If any set of 3 elements is equal to the constant c, then return false| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Java - 0of 0 votes
AnswerWrite a word processor that can do left and right justification for a sample input of string type.
- annu025 March 07, 2018 in United States
Here is an example:
This is a sample.This is a sample.This is a sample.
This is a sample.This is a sample.This is a sample.This is a sample.
Additional details:
* The left margin is 5 units.
* The right margin is 75 units.
* The input string is a single-spaced collection of words and punctuation.
* If the length of the word exceeds the right margin, then we must not break the word. Instead, we must print it on the next line and justify the existing line by adding more spaces to the middle of the line.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer String Manipulation - 0of 0 votes
AnswersA Research team want to establish a research center in a region where they found some rare-elements. They want to make it closest to all the rare-elements as close as possible so that they can reduce overall cost of research over there. It is given that all the rare-element’s location is connected by roads. It is also given that Research Center can only be build on road. Team decided to assign this task to a coder. If you feel you have that much potential..
- Jubayer February 01, 2018 in India
Here is the Task :- Find the shortest of the longest distance of research center from given locations of rare-elements.
Locations are given in the matrix cell form where 1 represents roads and 0 no road..
Number of rare-element and their location was also given(number<=5)
and order of square matrix was less than equal to (20).| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer - 0of 0 votes
AnswerThe question which has been asked is : how to share a variable across two unrelated process in Linux without using IPC.
- S@iR@m November 29, 2017 in India| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer Unix - 0of 0 votes
AnswersThe question which has been asked to me is : Print right angle triangle with stars(*) without nested loops. Implement in C programming language.
- S@iR@m November 29, 2017 in India| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer C# - 0of 0 votes
AnswersDesign a task execution service, which accepts tasks from clients and runs them and returns result. Following is how the
- CoolGuy November 27, 2017 in India
Client Registration (client name, callback method)
Submit Job to service
Once executed service will return the result to client
Lets assume that 20k jobs are getting submitted per second, you need to scale it in such a way that we are able to process as much jobs per second as possible.
Further questions:
So the components are going to be a load balancer, workstations, cache, task runner and DB. How will you make sure that data is consistent among them, mimimal duplication of data and every job is ran only once.
If any machine is down, say DB, workstation etc. how that is going to be handled.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 3of 5 votes
AnswersGiven two sorted linked lists, how can you combine them into one big sorted list? Do not create additional nodes.
- kredible November 12, 2017 in Singapore| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 0of 0 votes
AnswersThere is going to be a sale during this month. You are interested in a particular item and you found that different Vendors have different prices during different time periods. You collected the following information:
Vendor => (start date, end date, price) both sides inclusive A => (1, 5, $20) B => (3, 6, $15) C => (2, 8, $25) D => (7, 12, $18) E => (1, 31, $22)
As you can see, there are conflicting entries. You need to print out a non-conflicting schedule of prices, taking the best price from each period:
- kredible November 12, 2017 in Singapore
e.g.
(1, 2, $20), (3, 6, $15), (7, 12, $18), (13, 31, $22)| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 1of 1 vote
AnswersGiven a list of currency exchange rates like this:
EUR/USD => 1.2
USD/GBP => 0.75
GBP/AUD => 1.7
AUD/JPY => 90
GBP/JPY => 150
JPY/INR => 0.6
write a methoddouble convert(String sourceCurrency, double amount, String destCurrency);
For example, convert(EUR, 100, INR)
- kredible November 12, 2017 in Singapore
The method should minimize the number of intermediate conversions.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 0of 0 votes
AnswerGiven a grid of M*N size and robot is sitting on the top leftmost corner (0,0) and has to reach the bottom right most corner (M-1,N-1). Robot can only move up, down, left or right and cannot move diagonally. Find the shortest path on the grid.
- Shilpi_Roy November 04, 2017 in United States
Follow find total number of paths possible.| Report Duplicate | Flag | PURGE
Unity 3D Software Engineer / Developer - 0of 0 votes
AnswersWrite a function to convert a String of ip address to hex
- Shilpi_Roy 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?
- Shilpi_Roy 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 - -2of 2 votes
AnswerWhat is the Big O of that algorithm? What happens at runtime?
- rignanese.leo November 02, 2017 in Europe| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersWhat's the algorithm to transform the sentence "the brown fox ran fast" in "eht nworb xof nar tsaf" (reverse any word)
- rignanese.leo November 02, 2017 in Europe| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a merger and separator for Linked List.
- Shilpi_Roy November 02, 2017 in United States
eg: 1->2->3->4->5
separator()
1->3->5 and 2->4
merger()
1->2->3->4->5| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer Data Structures - 2of 2 votes
AnswersWrite a Java code that take a string of parenthesis as input and return if the string is valid or not . The input will have '(' and ')' and also '*' and * serves as wild card and can be used in place of both '(' and ')' or it can be null.
- ryanray1512 October 16, 2017 in United States
For example,the String (*)(*)(** is a valid String.
Follow up: What if '[]' and '{}' are also in the string along with '()' and * can be used in place of any of them or can be considered as null?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersYou are given a tree and any of the leaf node which is given as input is set to fire. And in each unit time all the neighbouring nodes of the nodes which are already in fire also catch fire. Given a tree find the time taken for the whole tree to catch fire.
- manikadanmanio October 10, 2017 in United States
The whole catches fire meaning all nodes catches fire.
Example :
4
/ \
5 6
/ \ / \
7 8 9 10
\ \
13 11
\
12
Assume the source leaf node : 9
At 1 sec : 6 catches fire
At 2 sec : 10 and 4 catches fire
At 3 sec : 5 catches fire
At 4 sec : 7 and 8 catches fire
At 5 sec : 13 and 11 catches fire
At 6 sec : 12 catches fire
If we have access to parent pointers its easy just BFS and keeping track of visited we get the answer.
How to go about the problem if we do not have access to parent pointers ??| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer Problem Solving - 4of 4 votes
AnswersAll jumbled numbers of n digits in max (worst case) O(n) and min (avg case) O(log n) time.
- mani0119 October 08, 2017 in India
A number is a jumbled number if the _absolute_ difference between adjacent digits is <=1.
For an input n=3
output should be
100
101
110
111
121
122
...
and so on.
The problem is similar to the one listed here https://www.careercup.com/question?id=5729332770111488
But this problem also has a O(n or log n) limitation and the solutions listed in the above mentioned problem at the time of posting this question, do not satisfy the criteria
PS: 001 is not a 3 digit number.
210 is absolutely fine as the absolute difference between adjacent digits is <=1.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDesign a data structure that supports 3 below operations
- Player October 07, 2017 in United States
1. GetNextId() : It returns the auto incremental next id. i.e 1 then 2 then 3 then 4
2. Acknolwdge(int i) : receives the acknowledgement of the id that was sent by GetNextId
3. GetIdLevel() : It returns the minimum id that has not been acknowledged| Report Duplicate | Flag | PURGE
Uber Software Engineer / Developer - 0of 0 votes
AnswersThere is a primary machine and a secondary(backup machine). Write a program to sync files from primary to backup machine
- Player October 07, 2017 in United States| Report Duplicate | Flag | PURGE
Uber Software Engineer / Developer - 0of 0 votes
AnswersIf you have 2 hotel rooms and 10 upcoming bookings. Such as
- Zhou Ziwei September 11, 2017 in Singapore for Developers
Booking 1. checkin Sept 1st to Sept 4
Booking 2. checkin Sept 9st to Sept 1
Booking 3. checkin Sept 1st to Sept 10
Booking 4. checkin Sept 11st to Sept 20
...
What should be the algorithm to optimize the room allocation?
When a new booking arrives in the future, how should the rooms to be re-allocated.| Report Duplicate | Flag | PURGE
Trio Sky Software Engineer / Developer Ruby - 0of 0 votes
AnswersWrite a logic to print the elements of 2D matrix in a spiral way?
- explorer August 25, 2017 in United States
for eg if int[][] matrix = {{1,2,3,4}{5.6,7,8}{9, 10, 11,12}};
The output should be 1 2 3 4 8 12 11 10 9 5 6 7
The interviewer asked me to implement a recursive algorithm.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 1of 1 vote
AnswersGiven a continuous stream of numbers, write a logic to find k maximum numbers at any given point of time where k is fixed?
- explorer August 25, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswerGiven some set of points in each quadrant of a 2D graph and two edges at a fixed angle, find the minimum angle at which the edges would cover maximum points between them?
- explorer August 25, 2017 in United States
I was confused on how to start and interviewer hinted me to consider each point at some angle from base (say 0) and continue finding all points which lies within the fixed angle.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersHow to design to record analytics for top n records that user listened in last 1 week? Please help.
- Ccq15 August 18, 2017 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer - 0of 0 votes
AnswersHow to design an image viewer app to see recent photos /albums from let's say Facebook? Please help
- Ccq15 August 18, 2017 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer - 1of 1 vote
AnswersImplement multithreaded rm -r <folder>, i.e recursively delete files/folder under <folder> by walking through it and assume there can be billions of files under folder and you can only delete folder if all contents in it are first deleted
- Erik August 17, 2017 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersImplement Ring Buffer with read and write pointers.
- anaghakr89 July 26, 2017 in United States
For example if the Ring buffer is implemented in the form of array of integers , one should be able to read / write more than one integer at a time. In short the data read / written should be in a chunk .| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 0 votes
AnswersPhone interview question from January.
We have a maze with three types of spaces:
1. Walls
2. Offices
3. Hallway space
Given a maze, determine which non-wall space would minimize the sum of all distances between that space and every office. You can only move up, down, left, and right.
(Edit: ChrisK described the problem more clearly than I did: "find the field that minimizes the sum of the shortest path[s] from this field to each office space.")
Example:WWWWWWWW WWW O WW WWW OW WWW WWWW WO WWWW WWW WWWW WO W WWWWWWWW
O = office, W = wall, spaces are hallway spaces
- mbs729 July 13, 2017 in United States
You can represent the maze however you want. That is, you can use any data structures you want, and you don't necessarily have to use O for office, W for Wall, and spaces for hallways.
(I'm not sure if you can actually start from an office space, but that should be a trivial issue because you can always just start a position adjacent to an office.)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm