Software Engineer Interview Questions
- 0of 0 votes
AnswersIn 5 minutes write a code which checks if a given number is a power of two.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersCheck if two given words are anagrams of each other.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 3of 3 votes
AnswersGiven two sorted arrays find the element which would be N-th in their merged and sorted combination.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersGiven a BST with unique values find in a given tree a value closest to a given value X.
- tested.candidate July 14, 2015 in Poland| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 1of 1 vote
AnswersA car rental company which rents car by per hour basis
- Goodprodd July 14, 2015 in United States
wants to know the time period for maximum number cars that are rented. ie you are given the list of rental start time and return times of all rented cars in the day for all cars in a day find the maximum time period in which cars are on the road.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersWrite a function to print unique rows of a matrix.
- ritwik_pandey July 13, 2015 in India
I am thinking of a 0(n) solution for this (if possible).
I am storing the rows of the matrix in a set of vectors and then printing those rows. Please tell me how to do this and the correct time complexity for that. I am not very good with STL.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Matrix - 2of 2 votes
AnswersHow would you store the relations in a social network like Facebook and implement a feature where one user receives notifications when their friends like the same things as they do?
- tested.candidate July 13, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 2of 2 votes
AnswersDesign Facebook Messenger backend
- tested.candidate July 13, 2015 in UK| Report Duplicate | Flag | PURGE
Facebook Software Engineer System Design - -1of 1 vote
AnswersDesign the front end of Google Calendar
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswersDesign YouTube view-counting feature
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswerDesign Google Suggest
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - -1of 1 vote
AnswersDesign Gmail backend (data storage and API)
- tested.candidate July 13, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer System Design - 0of 0 votes
AnswersGiven a single core processor and 2 processes executing programs with M and N atomic instructions. How many ways can a scheduler choose to execute them?
- Gear July 11, 2015 in United States
Example:
M =2 N = 1
Output:
3
{Ma Mb Na}
{Ma Na Mb}
{Na Ma Mb}| Report Duplicate | Flag | PURGE
Software Engineer Algorithm - 7of 11 votes
AnswersThe "surpasser" of an element in an array is defined as the number of elements that are to the "right" and bigger than itself.
- carchen2015 July 10, 2015 in United States
Example:
Array:
[2, 7, 5, 5, 2, 7, 0, 8, 1]
The "surpassers" are
[5, 1, 2, 2, 2, 1, 2, 0, 0]
Question: Find the maximum surpasser of the array.
In this example, maximum surpasser = 5| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 2of 2 votes
AnswersGiven a binary tree, implement an iterator that will iterate through its elements.
- carlosgsouza July 07, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersYou have a function f1() that generates 0 or 1 with the equal probability. Write a function f29() that generates a number between 0 and 29 with equal probability.
- azaad2004 June 29, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Algorithm - 0of 0 votes
AnswersWrite a function to print Tree which can have any number of nodes, in level order each level in new line.
- snehit.gajjar June 25, 2015 in United States
1
2 3
4 5 6
if above is tree then answer should be,
1
2,3
4,5,6| Report Duplicate | Flag | PURGE
Groupon Software Engineer Algorithm - 3of 3 votes
AnswersPrint the level of friendship.
- AnonD June 24, 2015 in United States
Given a person and list of his friends, print all his friends by level of association.
The text file will be like one below
A: B,C,D
D: B,E,F
E: C,F,G
If the input is A, the out put should be:
Level 1 - B,C,D
Level 2 - E,F
Level 3 - G| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 4of 4 votes
AnswersYou are given 2 documents. We want to know how similar they are through N-Grams.
- um01 June 20, 2015 in United States
Given an input n (n = number of word in the Ngram) and two documents(strings) find the intersection of the NGrams of two document.
E.g doc1 = 'This is a dog'
doc2 = 'This is a cat'
n = 3
Ngrams for doc1 = 'This is a', 'is a dog'
Ngrams for doc2 = 'This is a', 'is a cat'
Output 'This is a'
Find a efficient way and give its complexity.| Report Duplicate | Flag | PURGE
Google Software Engineer - 2of 2 votes
Answersstd C library has pow(x, n) function - implement that function
- kumarr.arvind June 20, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersGiven a collection of pair representing intervals write a function which inserts new interval into collection and merges overlapping intervals.
- Eugene June 17, 2015 in United States
Example:
[-10, -1], [0,2], [4,10]
insert [-5, 1]
output: [-10, 2], [4, 10]| Report Duplicate | Flag | PURGE
Linkedin Software Engineer Algorithm - 10of 12 votes
AnswersGiven a max-heap represented as an array, return the kth largest element without modifying the heap. I was asked to do it in linear time, but was told it can be done in log time.
- lilzh4ng June 10, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 2 votes
AnswersGiven a sorted array, find a way to find the # of occurrence of a number
- aj June 09, 2015 in United States
for eg: [1, 1, 2, 3, 3, 3, 4, 5]
find # of occurrence of 3 in time better than O(n)| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 4 votes
AnswersGiven a range of floats, find the range of size 1 with max num of elements
- aj June 09, 2015 in United States
for eg: [-13.7, -14.5, -12.3, -12.5, -12.9]
one possible answer: [-12.3, -13.3]| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - -1of 1 vote
Answers
- JSDUDE June 04, 2015 in United Statespublic class StringUtilities { /** * Count the maximum depth of parenthesis nesting, i.e. "abc(123(xyz))m(((n)))o" -> 3. * * @param input * any string * @return deepest parenthesization level * @throws IllegalArgumentException * if input is null or contains a mismatch "a)b(c" or "a(b" */ public static int nestedParenthesisDepth(String input) throws IllegalArgumentException { //... } }
| Report Duplicate | Flag | PURGE
Walmart Labs Software Engineer Algorithm String Manipulation - 2of 2 votes
AnswersGiven an array and is rotated n number of times find the number where the peak happens. The array is sorted in increasing order. Follow up question: how will you rearrange them in normal sorted order.
- madhur.eng June 03, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersSuppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. you are only allowed to move up, left, right and down. Diagonal movement is not allowed.
- anom May 28, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end 0,3
Output - true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output - false| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 4of 4 votes
AnswersGiven an array of integer nos. All numbers are distinct.
- pavel.em May 22, 2015 in United States
WAP to find the two longest non-intersecting continuous subarrays
of equal size s.t. *all* elements of one of them are smaller than that of the other subarray:
a[i..i + k - 1] and a[j..j+k-1] where i + k <= j
s.t. a[i..i + k - 1] < a[j..j+k-1] or a[i..i + k - 1] > a[j..j+k-1]
and k is maximal
Example: a = {1,2,3, 7, 9, 8} then we have: {1, 2, 3} and {7, 9, 8}
a = {6, 5, 4, 1, 3, 7} then we have:
{6, 5} and {4, 1} or
{6, 5} and {1, 3} or
{5, 4} and {1, 3} ...| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Algorithm - 0of 4 votes
Answersi18n (where 18 stands for the number of letters between the first i and the last n in the word “internationalization,”) Wiki it.
- Gcrack May 22, 2015 in United States
Generate all such possible i18n strings for any given string. for eg. "careercup"=>"c7p","ca6p","c6up","car5p","ca5up","care4p","car4up","caree3p","care3up"..till the count is 0 which means its the complete string again.| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm Arrays - 2of 2 votes
AnswersGiven an bunch of airline tickets with [from, to], for example [MUC, LHR], [CDG, MUC], [SFO, SJC], [LHR, SFO], please reconstruct the itinerary in order,
- blah_blah May 18, 2015 in United States
for example: [ CDG, MUC, LHR, SFO, SJC ].
//tickets can be represented as nodes| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm