Software Engineer Interview Questions
- 1of 1 vote
AnswersGiven the arraylist<meals> input, find the number of dishes with unique ingredients.
class meals{ String cuisine; ArrayList<String> dish = new ArrayList<String>(); meals(String s, String[] arr){ cuisine = s; for(String i:arr){ dish.add(i); } } }
Example:
- venkataratnamkumar7777 September 18, 2018 in United States
Input: [
{
"cuisine" : "American",
"dish" : ["lettuce", "cheese", "olives", "tomato"]
},
{
"cuisine" : "Mexican",
"dish" : ["lettuce", "cheese", "pepper", "tomato"]
},
{
"cuisine" : "French",
"dish" : ["lettuce", "cheese", "pepper", "tomato"]
},
{
"cuisine" : "Continental",
"dish" : ["lettuce", "cheese", "olives", "tomato"]
},
]
Output: 2
Because there are two unique ingredient-dishes; {Mexican, French} and {American, Continental}.
I have tried different methods, but could not get to the solution. Thank you!| Report Duplicate | Flag | PURGE
Yelp Software Engineer Java - 0of 0 votes
AnswerGiven a point and a radius r, draw a circle.
- Wandering programmer September 12, 2018 in United States| Report Duplicate | Flag | PURGE
Pure Storage Software Engineer C C++ - 0of 0 votes
AnswersDesign a portal for registration for a dog show
- interviewquestionsseeker September 07, 2018 in United States| Report Duplicate | Flag | PURGE
Akamai Software Engineer - 0of 0 votes
AnswersFind 2nd duplicate in an array
- interviewquestionsseeker September 07, 2018 in United States| Report Duplicate | Flag | PURGE
Akamai Software Engineer Algorithm - 0of 0 votes
AnswersGiven 2 sets of words. Find the words in 2nd set that begin with any word in the 1st set.
- interviewquestionsseeker September 07, 2018 in United States| Report Duplicate | Flag | PURGE
Akamai Software Engineer Algorithm - 0of 0 votes
AnswerLargest Sum Contiguous Subarray
- interviewquestionsseeker September 07, 2018 in United States| Report Duplicate | Flag | PURGE
Akamai Software Engineer Algorithm - 0of 0 votes
AnswersGiven integer m and n where n is odd, for all mxn matrixes that consist of 0 and 1, find the one that has max count of 1s and meets following conditions:
- akak18183 August 31, 2018 in United States
1. All 0s are connected;
2. All 1s are adjacent to at least one 0 (Adjacent includes diagonal line adjacent, 8 directions);
3. maxtrix[m-1][n/2] = 0.
Example :
Input: m=2, n=3
Output: [[1,1,1],[1,0,1]]
Follow up:
Given another list of 'blocked' points. Matrix will set those points to -1 and you cannot change that. Solve the problem again.| Report Duplicate | Flag | PURGE
unknown Software Engineer Algorithm - 0of 0 votes
AnswersWhat’s a feature you’d love to add to our product? (~1-3 sentences)
- ruta.gadgil August 31, 2018 in United States for Penny| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 0of 0 votes
AnswersWhat’s one thing that excites you and one thing that bothers you
- ruta.gadgil August 31, 2018 in United States for Penny
about the tech industry? (~2-4 sentences)| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 0of 0 votes
AnswersWhat were some characteristics of your favorite or ideal group of
- ruta.gadgil August 31, 2018 in United States for Penny
people to work with? (~1-3 sentences)| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 0of 0 votes
AnswersWhat's the most helpful feedback you've ever gotten about yourself?
- ruta.gadgil August 31, 2018 in United States for Penny
(~1-3 sentences)| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 0of 0 votes
AnswersWhat personality traits do you butt heads with? (~1-3 sentences)
- ruta.gadgil August 31, 2018 in United States for Penny| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 0of 0 votes
AnswersWhat is idempotence and why is it useful for API design? (~2-6
- ruta.gadgil August 31, 2018 in United States for Penny
sentences)| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Algorithm - 0of 0 votes
AnswersLooking at this function, what bugs do you see or concerns do you have
- ruta.gadgil August 31, 2018 in United States for Penny
about its functionality? You can assume the models are correctly
{{defined, the schema is correct, etc. (~1-3 sentences)
def send_email_to_user_once!(to_user_id:, type:, subject:, body:)
user = User.find(to_user_id)
return if UserEmailLog.where(user_id: user.user_id, email: type).exists?
send_email(to: user.email, subject: subject, body: body)
UserEmailLog.create!(user_id: user.user_id, email: type)
end
def send_email(to:, subject:, body:)
# Makes a blocking network request to Amazon Simple Email Sender
# to send an email. Returns nothing in all cases.
# See this link for more info if you need it.
end}}| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Algorithm - 0of 0 votes
AnswersWhat does this Javascript ES6 function do and how is it useful? If you
- ruta.gadgil August 31, 2018 in United States for Penny
had to give the function a name, what would it be? (~1-2 sentences)
{{
function operate(l, s, callback) {
a = s
for (let i = 0; i < l.length; i++) {
a = callback(a, l[i])
}
return a
}
}}| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Algorithm - 0of 0 votes
AnswersYour uncle grew up without a computer, grabs a fly swatter when he
- ruta.gadgil August 31, 2018 in United States for Penny
hears the word “bug,” and still insists on faxing you things. How would
you explain the concept of an API to him, keeping in mind that most
technical terms will likely be foreign to him? (~2-12 sentences)| Report Duplicate | Flag | PURGE
CreditKarma Software Engineer Behavioral - 5of 5 votes
AnswersYou are given a campus map with the Google buildings, roads and Google
bikes. You have to help the employee find the nearest Google bike.
Campus map:
- john August 29, 2018 in United States. - Free path/road # - Building B - Google bike Employee location - (x, y) - (1, 2) . . . . . # . . E . . # # # # # . # . B . . . . . . . . . B
| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 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 - 2of 2 votes
AnswersGiven a binary tree, find the closest LEAF node to the target.
- aonecoding August 24, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - -1of 1 vote
AnswersGiven two string check if they can be made equivalent by performing some operations on one or both string.
- alex August 09, 2018 in United States
swapEven:swap a character at an even-numbered index with a character at another even-numbered index
swapOdd:swap a character at an odd-numbered index with a character at another odd-numbered index
Given : s="cdab" , x="abcd"
s -> cdab ->swap a and c ->adcb (swapEven)-> swap b and d (swapOdd) -> s="abcd" = x="abcd"
Given: s="dcba" , x="abcd"
no amount of operation will move character from an odd index to even index, so the two string will never be equals
Given: s="abcd" ,x="abcdcd"
x length to big so will never be equals| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 4 votes
AnswersGiven an array of lower case strings, the task is to find the number of strings that are special equivalent.
- boony August 09, 2018 in United States
Two strings are special equivalent if they can be made equivalent by performing some operations on one or both string
swapEven : swap a character at an even-numbered index with a character at another even-numbered index
swapOdd : swap a character at an odd-numbered index with a character at another odd-numbered index
Input : arr = {"abcd", "cbad", "bacd"}
Output : 2
The 2nd string can be converted to the 1st by swapping
the first and third characters. So there are 2 distinct
strings as the third string cannot be converted to the
first.
string input[] = {"abcd", "acbd", "adcb", "cdba",
"bcda", "badc"};
ans =4| Report Duplicate | Flag | PURGE
Facebook Software Engineer - -1of 1 vote
AnswersGiven an array of lower case strings, the task is to find the number of strings that are distinct.
- boony August 09, 2018 in United States
Two strings are distinct if they can be made equivalent by performing some operations on one or both string
swapEven : swap a character at an even-numbered index with a character at another even-numbered index
swapOdd : swap a character at an odd-numbered index with a character at another odd-numbered index
Input : arr = {"abcd", "cbad", "bacd"}
Output : 2
The 2nd string can be converted to the 1st by swapping
the first and third characters. So there are 2 distinct
strings as the third string cannot be converted to the
first.
string input[] = {"abcd", "acbd", "adcb", "cdba",
"bcda", "badc"};
ans =4| Report Duplicate | Flag | PURGE
US Software Engineer - 0of 0 votes
Answersdesign an email job that would deliver high number of emails and will work on a really old and slow hardware.
- Rx100 August 07, 2018 in United States| Report Duplicate | Flag | PURGE
Software Engineer design - 0of 0 votes
Answershow to design a system to fast lookup cars on the market according to the user's geo position.
- Rx100 August 07, 2018 in United States| Report Duplicate | Flag | PURGE
Software Engineer design - 2of 2 votes
AnswersQuestion : Given a set of N numbers [1,N], partition them into 2 disjoint subsets based on a set of K queries.
- robb.krakow July 25, 2018 in United States
Each query is of the type (n1, n2) where n1 and n2 are distinct numbers from the set and n1 and n2
belong to opposite subsets.
Example:
Input:
Input:
N = 4
K = [(1, 2), (1, 3), (2, 4)]
Output:
Set 1 : (1,4)
Set 2 : (2,3)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Data Structures - 1of 1 vote
AnswersFind all triplet that sum to a given value in an array of integers, given that the array is too big to fit into memory
- intuiti July 19, 2018 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer - 1of 1 vote
AnswersDesign and implement a interest matching algo, to match people according to their interests in a particular area.
- ANONU July 06, 2018 in United States
Suggest a score based on their interests. And rank matchings accordingly.| Report Duplicate | Flag | PURGE
Zynga Software Engineer Algorithm System Design - 0of 0 votes
AnswersYou are standing in the top-left corner of n*m grid. At each step you can only move up, down, right or left. Count the number of unique paths to the bottom-right corner of the grid (paths cannot cross themselves). The interviewer suggested that a backtracking solution is not the most performant one.
- adr July 04, 2018| Report Duplicate | Flag | PURGE
Software Engineer - 1of 1 vote
AnswerGiven an undirected graph represented as a list of edges, find out the number of connected component.
- aonecoding June 25, 2018 in United States| Report Duplicate | Flag | PURGE
Twitter Software Engineer - 0of 0 votes
AnswersDesign a concurrent hashmap.
- ANONU June 13, 2018 in United States
Please point me to the link if this has been discussed before.
They wanted design with code snippet of the classes.| Report Duplicate | Flag | PURGE
Uber Software Engineer System Design