Software Engineer Interview Questions
- 0of 0 votes
AnswersYou have rating (0-10) of the hotels per user in this format:
- theconqueror July 06, 2016 in United States
scores = [
{'hotel_id': 1001, 'user_id': 501, 'score': 7},
{'hotel_id': 1001, 'user_id': 502, 'score': 7},
{'hotel_id': 1001, 'user_id': 503, 'score': 7},
{'hotel_id': 2001, 'user_id': 504, 'score': 10},
{'hotel_id': 3001, 'user_id': 505, 'score': 5},
{'hotel_id': 2001, 'user_id': 506, 'score': 5}
]
Any given hotel might have more than one score.
Implement a function, get_hotels(scores, min_avg_score) that returns a list of hotel ids that have average score equal to or higher than min_avg_score.
get_hotels(scores, 5) -> [1001, 2001, 3001]
get_hotels(scores, 7) -> [1001, 2001]
*/
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 1of 1 vote
AnswersYou have an array of unique integer numbers and only one operation: MoveToFront(x) that moves given number to the beginning of the array.
- emb July 02, 2016 in United States
Write a program to sort the array using the minimum possible number of MoveToFront() calls.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 0 votes
AnswersImplement a web crawler. Follow up - parrarelize it.
- Lively July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswersGiven points on the Cartesian plane. Return the K points closest to the origin (0,0).
- Lively July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswersImplement a Reader/Writers lock by only using primitive locking semantics (such as mutex,semaphore, etc..)
- Lively July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Coding - 0of 0 votes
AnswersYou are given a "hand" in the game of blackjack. where cards are numbered 1 - 10, A = 1/11 J - 12,Q - 13, K - 14. a Hand consists of several cards. Given a single hand, you need to return the score of that hand which is closest to 21.
- Lively July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer - 0of 0 votes
AnswersGiven an N X M matrix where some position are free and some have trees in them. You can build a house on any group of free positions that form a square (including a single position). Return the largest house you can build given these requirements.
- Lively July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Zillow Software Engineer Algorithm - 0of 0 votes
AnswerImplement a data structure to represent this
- Anonymous June 29, 2016 in United States
[1,[2],[[[5]]],6,7,8]. Multi level indirection with in a list| Report Duplicate | Flag | PURGE
Uber Software Engineer Data Structures - 4of 4 votes
AnswersYou have rand2() function which returns 0 or 1 with equal probability. You should implement rand3() using rand2().
- nfokin June 20, 2016 in Russia| Report Duplicate | Flag | PURGE
Yandex Software Engineer Algorithm - -8of 8 votes
AnswersGiven set of characters and a dictionary find the minimum length word that contains all the word from the given word
- darklight June 19, 2016 in India| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersGiven an array of n integers. MaxPrefix is defined as count of elements those are greater than the element and in the right side of array wrt to the element. Write a program to give the max of MaxPrefix Ex. Input 10 -4 6 2 8 9 4 Output is 5
- darklight June 19, 2016 in India| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersFind the % match of a string given a list of strings. See below example:
- localghost June 07, 2016 in United States
// Input: String word, List<String> glossary
// Output: % match
// 'catdog', ['dog', 'frog', 'cat'] => 100%
// 'cardog', ['dog', 'frog', 'cat'] => 50%| Report Duplicate | Flag | PURGE
Software Engineer Algorithm - 0of 0 votes
AnswersGiven deck of cards let se 50 cards, now all are thrown on a table, after throwing some cards of them are now with face up and some are with face down, tell the probability of sum of all the face up cards is divisible by 7.
- Ajay Kumar May 29, 2016 in United States for Google Docs
Assume cards from 1 to 10, Answer should be generic so that we can get results for any number of cards, don't compare cards with playing cards, cards can be numbered from 1 to n| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersEliminate all the anagrams from an Array of 100 Strings!
- PS May 26, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersGiven an api which returns an array of chemical names and an array of chemical symbols, display the chemical names with their symbol surrounded by square brackets:
- abcpiipii May 25, 2016 in United States
Ex:
Chemicals array: ['Amazon', 'Microsoft', 'Google']
Symbols: ['I', 'Am', 'cro', 'Na', 'le', 'abc']
Output:
[Am]azon, Mi[cro]soft, Goog[le]
If the chemical string matches more than one symbol, then choose the one with longest length. (ex. 'Microsoft' matches 'i' and 'cro')
My solution:
(I sorted the symbols array in descending order of length and ran loop over chemicals array to find a symbol match(using indexOf in javascript) which worked. But I din't make it through the interview, I am guessing my solution was O(n2) and they expected an efficient algorithm.| Report Duplicate | Flag | PURGE
Uber Software Engineer Algorithm String Manipulation - 0of 0 votes
AnswersGiven an MxN matrix, determine whether a path can be drawn through every node in the matrix such that the end node is next to the start node, and each node is only touched once.
- geekofthegeeks May 23, 2016 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersGiven a binary tree, find the largest subtree having atleast two other duplicate subtrees .
- geekofthegeeks May 22, 2016 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersGiven the following decoder, write the encoder. (The encoder should be written to compress whenever possible):
- geekofthegeeks May 22, 2016 in United States
p14a8xkpq -> p14akkkkkkkkpq
(8xk gets decoded to kkkkkkkk. The only other requirement is that encodings be unambiguous)
Note that the String can have any possible ascii character| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - -1of 1 vote
AnswersWrite a program to find the given number N is EVEN or NOT.
- vinijasreevalsam May 18, 2016 in India| Report Duplicate | Flag | PURGE
Software Engineer - 0of 0 votes
AnswersConsider its side lengths are integer values.
- vinijasreevalsam May 18, 2016 in India
1. If bar is not square in shape, then the largest possible square piece of Cadbury is broken and given to the first child in queue.
2. If bar is square in shape, then complete bar is given to the first child in queue.| Report Duplicate | Flag | PURGE
Agilent Technologies Software Engineer - 1of 1 vote
AnswersYou are given a string "abc" which is encoded like "123" where alphabets are mapped like a => 1 to z => 26. Now find out how many string can be formed by reverse engineering encode string "123".
- sachin323 May 16, 2016 in United States
For ex. given string "123" we can form 3 string "abc"(1,2,3), "lc" (i.e 12,3), "aw"(1,23).
for string "1234" we have following possible combinations, I might be missing some of them but you get the idea
{12, 3, 4}
{1, 23, 4}
{1, 2, 3, 4}| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 0 votes
Answers// Reverse the words. Given a String that contains words separated by single space, reverse the words in the String. You can assume that no leading or trailing spaces are there.
// For example: "Man bites dog" => "dog bites Man”
- almunayer May 10, 2016 in United StatesString reverseWords(String value) { // Insert implementation }
| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 1of 1 vote
AnswersSelect Kth largest value in the array. Given an unsorted array of size n, and a value k. Select the kth largest value from the array.
For example:
Array is [5, 3, 9, 1], n is 4
k = 0 => 9
k = 1 => 5
k = 3 => 1
- almunayer May 10, 2016 in United Statespublic int kthLargest(int array[], int k) { // ..... }
| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 2 votes
AnswersGiven a list of pies (and the number of slices in each pie) calculate the maximum number of slices that nPeople could receive if each person got the same amount of slices and did not get slices from more than 1 pie.
- Dinkleberg May 09, 2016 in United Statespublic int getMaxSlices(List<Integer> pieSlices, int nPeople) { // return answer }
| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersGiven two sorted linked lists of integers write an algorithm to merge the two linked lists such that the resulting linked list is in sorted order. You are expected to define the data structure for linked list as well. Analyze the time and space complexity of the merge algorithm.
- vkoolkatz April 28, 2016 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Data Structures - 2of 2 votes
AnswersYou are designing a system the records website visits. The interface for this system is:
- taylor.halliday April 26, 2016 in United States
void recordHit();
long getCount();
`getCount()` returns the amount of hits to the site for only the last 5 minutes.
Your task is to code `recordHit()` and `getCount()`| Report Duplicate | Flag | PURGE
Dropbox Software Engineer Algorithm - -15of 17 votes
AnswersIs Golang a good choice for coding interviews?
- amit April 20, 2016 in India| Report Duplicate | Flag | PURGE
Google Software Engineer - -16of 18 votes
AnswersDoes Google/Microsoft/Amazon/Facebook allow Golang in coding interviews?
- amit April 20, 2016 in India| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm