Software Engineer Interview Questions
- 0of 0 votes
AnswersAn ABC notation in a tree is defined as folllows:
- npkatre104 June 16, 2017 in United States
1. "0" means travel left
2. "1" means travel right
3. "Undefined" means hit the root
4. "Not Found" means not present in tree
Given a BST insertion order, {5,2,8,3,6,9,1} find the ABC notation for 6, 1, 10, 2 which is "10","00","NotFound", "0"| Report Duplicate | Flag | PURGE
Apple Software Engineer - 5of 5 votes
AnswersGoogle On-site in May
- aonecoding June 15, 2017 in United States
Create a class with a collection of integers.
Enable 3 APIs:
void append(int x),
int get(int idx),
void add_to_all(int x),//add x to all numbers in collection
These methods should run in O(1) time.
Follow-up
In addition, implement
void multiply_to_all(int x)
The same required to run in O(1) time| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersGiven a n*m size 2D array with integers from 1 to n*m - 1 in it.
- ajay.raj June 08, 2017 in United States
Integers are not sorted. The last position of the matrix stays a movable block.
For each time, you can swap the movable block with any adjacent number.
And eventually you will have the integers sorted and the movable block returned
to its starting position. Think about an approach to print the path.
(You can assume it always have at least a solution)| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswersHow to get the repeating decimal pattern of a division? (e.g 1/3, 1/6)
- ajay.raj June 08, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 1of 1 vote
AnswersGiven a preorder traversal of a BST, print out the inorder transversal of the BST
- ajay.raj June 06, 2017 in United States
public void printInorder(int[] nums){}| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 1of 1 vote
AnswersImplement circular buffer with read & write functions
- aonecoding June 06, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Data Structures - 1of 1 vote
AnswersCoding III
- aonecoding June 06, 2017 in United States
Implement int divide(int a, int b) without division or mod operation.
## Round IV
Behavioral Questions + Project Walk Through + Coding (Validate BST)
## System Design V
Design memcache to enable read, write and delete (single server, non-distributed infrastructure).
Which data structure to go with?
Eviction rules?
How to minimize segmentation?
How to handle concurrency?
## Extra
After two weeks they called me to an extra round of system design.
How to store social graphs?
How to handle concurrent read/write requests(read heavy) on one server.| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswerGiven a m x n array filled with 1's & 0's. Find all the rectangles which are filled with all the 1's.
- Seeker June 01, 2017 in United States
Note : - It is guaranteed that there won't be any overlapping rectangles.| Report Duplicate | Flag | PURGE
MuleSoft Software Engineer Algorithm - 2of 2 votes
AnswersFind Famous person in the list of persons.
- Seeker June 01, 2017 in United States
A person is a famous person if he doesn't know anyone in the list and everyone else in the list should know this person.
The function isKnow(i,j) => true/ false is given to us. No need to worry about it.
Goal is to find the famous person in O(n) complexity.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 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 - 1of 1 vote
AnswersGiven a 2D character array of size NxN. Find if there is a path from the cell 'R' to the cell 'T'. You can go left, right, up, down from a cell and you cannot pass through any cell marked with 'X'.
- Thor May 25, 2017 in United States
Example input:
X__R_X
X_XXX_
______
_XX_XX
XT__X_
Output: true| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswersPrint all permutations of a given string.
- Thor May 25, 2017 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 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 - 1of 1 vote
AnswersYou have a array with integers:
[ 1, -2, 0, 6, 2, -4, 6, 6 ]
You need to write a function which will evenly return indexes of a max value in the array.
- vu-doo-cok May 22, 2017 in UK
In the example below max value is 6, and its positions are 3, 6 and 7. So each run function should return random index from the set.
Try to implement with O(n) for computation and memory.
Try to reduce memory complexity to O(1).| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - 0of 0 votes
AnswersYou have a binary tree which consists of 0 or 1 in the way, that each node value is a LOGICAL AND between its children:
0 / \ 0 1 / \ / \ 0 1 1 1
You need to write a code, which will invert given LEAF and put tree in a correct state.
- vu-doo-cok May 22, 2017 in UK| Report Duplicate | Flag | PURGE
Facebook Software Engineer Data Structures - 0of 0 votes
AnswersGiven a binary tree of integers, write code to store the tree into a list of integers and recreate the original tree from a list of integers.
- Null0 May 13, 2017
Here's what your method signatures should look like (in Java):
List<Integer> store(Node root)
Node restore(List<Integer> list)
Example Tree:
5
/ \
3 2
/ / \
1 6 1| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm Data Structures Java Trees and Graphs - 0of 0 votes
AnswersImplement pow(x, n)
- alisonlee659 May 03, 2017 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Algorithm - 1of 1 vote
AnswersPick three numbers a, b, c from an array of integers to get the maximum product a * b * c.
- alisonlee659 May 03, 2017 in United States
Began with the O(N^3) solution. Then the interviewer give clues on optimization by sorting the array.| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Algorithm - 0of 0 votes
AnswersGiven a large file with sentences and query string, design a system (Class, data structs, functions, etc) and algorithm to return the smallest window (start and end offsets) in the input file where the query words (in any order) are seen in the text file. What is the time complexity?
- Ray May 01, 2017 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 2of 2 votes
AnswersGiven an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words.
- Anon April 29, 2017 in United States
Ex: "bedbathandbeyond" would be "bed bath and beyond" which are all dictionary words.| Report Duplicate | Flag | PURGE
Facebook Software Engineer String Manipulation - 1of 1 vote
AnswersGenerate a random 4-digit even number : the adjacent 2 digits must be different.
- ajay.raj April 28, 2017 in United States
public int getNumber(){
}| Report Duplicate | Flag | PURGE
Google Software Engineer - -1of 3 votes
AnswersAmazon SDE 2 On-site (4 of 4 Rounds)
- aonecoding April 23, 2017 in United States
Assume that there is an e-book application. For every book the sharable part of the book content cannot exceed 10% of the whole book. Design a module to decide whether the current part of content is sharable.
The description given is vague. I had to push him with questions to give the details.
At first I thought the problem was about strStr. But then the interviewer said that even if there are two paragraphs of the book content with the exact same texts, as long as they are not in the same place, they would be considered different content.
I then realized it’s a question about merging segments - have a helper to find each pair of start and end point of the input content (given multiple separated paragraphs). Then merge the intervals and see if they combined exceed 10% of the entire book.
The interviewer approved my solution and ask me to code it.
Overall I feel like that the Amazon SDE II Interview doesn’t focus on just algorithm. It’s more about problem solving in practice and then implement the only core function on whiteboard.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswerDesign an electronic voting system for india , design its schema , scaling its working, failure conditions & optimization
- Harsh Bhardwaj April 20, 2017 in India| Report Duplicate | Flag | PURGE
AppPerfect Software Engineer design - 0of 0 votes
Answersfind the isomorphic pairs of string !!
- Harsh Bhardwaj April 20, 2017 in India
a string is said to be isomorphic if its each alphabets can be replaced by another alphabet
for ex "abca" and "zxyz" are isomorphic but "abca" and "pqrs" is not isomorphic
conditions :
1 - A character can be replaced by itself. for ex "abcd" and "pbfg" are isomorphic .
2- No two characters can be replaced by same character . for ex "abcd" and "bbcd" are not isomorphic .| Report Duplicate | Flag | PURGE
AppPerfect Software Engineer Algorithm - 0of 0 votes
AnswersFind the subarray within an array (containing at least TWO number) which has the largest sum.
- ajay.raj April 20, 2017 in United States
For example, given the array [-2,-1,-3,-4,-1],
the contiguous subarray [-2,-1] has the largest sum = -3.
try to do it in O(n) time
Followup, if input is stream, how to solve it
public int maxSubArray(int[] nums) {}| Report Duplicate | Flag | PURGE
Facebook Software Engineer - -1of 1 vote
AnswersSorry had to remove this question
- Anonymous_geek April 19, 2017 in United States| Report Duplicate | Flag | PURGE
Software Engineer Algorithm - 0of 0 votes
AnswersWrite code for the following: given a text file containing this information (Date the customer is logged in, tab, customer id)
- aifra2000 April 18, 2017 in United States for Amazon Alexa
04/11/2017 /t 0003
04/12/2017 /t 0003
04/13/2017 /t 0004
04/13/2017 /t 0003
How to get the list of those customers that log in on three consecutive days.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersOOPS: How to design Amazon locker? Provide code using OOP
- aifra2000 April 18, 2017 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer - -1of 1 vote
AnswersHow to merge two binary trees in place? (without creating a new node)
- aifra2000 April 18, 2017 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer