Software Engineer Intern Interview Questions
- -2of 2 votes
Answersgiven an integer array , find all combinations which sum to a given number. If a number is used once, it must not be used again.
- pooja January 31, 2016 in United States
eg if input array is 6444 and sum =10
output must be just 6 4
Give an O(n) solution| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern - 0of 0 votes
Answersgiven a string with only paranthesis - find out if it is balanced or not
- pooja January 31, 2016 in United States
eg {}[]()
followup : scale your solution and specify the right data structure to use if you have a lot of such bracket types| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern - 3of 3 votes
AnswersTask schedule: given a sequence of task like A B C(means 3 different tasks), and a coldtime, which means you need to wait for that much time to start next [same] task. Now----
- songty11 January 27, 2016 in United States
Input: string, n
Output: the best task-finishing sequence.
eg. input: AAABBB, 2
Output: AB_AB_AB
( "_" represents do nothing and wait)| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm - 0of 0 votes
AnswersWrite a program to sort the numbers using singly linked list in O(nlogn) time complexity and O(1) space complexity?
- user December 26, 2015 in India| Report Duplicate | Flag | PURGE
Software Engineer Intern - 0of 0 votes
AnswersWrite func repeat(e, n).
- ab123 November 12, 2015 in United States
Args:
e: any object
n: a number of times
Returns:
an iterator producing the element e n times| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Data Structures - 1of 3 votes
AnswersGiven an array A = [3, 7, 2,5,6,4] for a number N, print the pairs from that array A that sums up to N. You should print each pair once.
- nonameno October 29, 2015 in England| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern - 0of 0 votes
AnswersGiven an array A [0, 1, 3, 4,9,5,7,6] and number N.
- nonameno October 29, 2015 in England
This means that the array consists of the numbers from 0 ... N. However, as you see, 8 is missing in A. Print the missing number.
Think about the case N = 10^6| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Algorithm - 1of 1 vote
AnswersGiven an array of "array range", return an optimized array by deleting subarrays.
- dark_knight October 19, 2015 in United States
NOTE: Array range (2,6) represents (2,3,4,5,6)
INPUT: [(2,6),(3,5),(7,21),(20,21)]
OUTPUT: [(2,6),(7,21)]
Reason: (3,5) is a subarray of (2,6) and (20,21) is a subarray of (7,21)| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Algorithm - 1of 1 vote
AnswersGiven a sentence in a form of a string, reverse the words in the string and return a string. Handle a case where there might be period at the end of the sentence. If there is a period, the period has to come to the end of the reversed sentence. Discuss the time complexity of your algorithm.
- dark_knight October 18, 2015 in United States
INPUT: "This is a sentence"
OUTPUT: "sentence a is This"
INPUT2: "This one has period."
OUTPUT2: "period has one This."| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern Algorithm - 0of 0 votes
AnswersGiven n, return 1 ^ 2 ^ 3 ^ ... ^ n
Where ^ is binary xor.
Note: n is a 64-bit number, and 1<<63 is a valid n for this problem.
Examples:
- emb October 07, 2015 in United States>>> reduce(lambda a,b:a^b, [1,2,3]) 0 >>> reduce(lambda a,b:a^b, [1,2,3,4]) 4 >>> reduce(lambda a,b:a^b, [1,2,3,4,5,6,7]) 0 >>> reduce(lambda a,b:a^b, [1,2,3,4,5,6,7,8,9]) 1
| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern - 0of 0 votes
AnswersWrite an algorithm for a robot navigating a maze.
- Ray April 19, 2015| Report Duplicate | Flag | PURGE
Software Engineer Intern System Design - 0of 0 votes
AnswersWrite an algorithm to control an alarm clock.
- Ray April 19, 2015| Report Duplicate | Flag | PURGE
Software Engineer Intern System Design - -5of 7 votes
AnswersSort an integer array with three functions: findMin(), findMedium(), findMax().
- VV April 17, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Sorting - 0of 0 votes
Answersgiven an array (list) of integers return true(boolean function) if two of the numbers add to 12.
- nitz April 15, 2015 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Java - 0of 0 votes
AnswersGiven two sorted LinkedLists, merge them into one sorted LinkedList
- owasserman2012@my.fit.edu March 27, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern - 0of 0 votes
AnswerHashmap(what is it, time complexity of insertion and deletion)
- owasserman2012@my.fit.edu March 27, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern - 0of 0 votes
AnswersGiven a 1D array with integers,print vertical bars of # such that if a[i] = n, then print # n times from the bottom.
- bestluck March 10, 2015 in United States
For eg, {1,4,3,2}
o/p : #
# #
# # #
# # # #| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern Java - 0of 0 votes
AnswersWrite a function that would print all positive numbers smaller than n that can be expressed as the sum of two cubes in two different ways. Bonus: calculate the complexity of that function.
- demonix February 17, 2015 in United States
For example, 1729 is one such number because 1729 = 1^3 + 12^3 = 9^3 + 10^3.| Report Duplicate | Flag | PURGE
Google Software Engineer Intern - 0of 0 votes
AnswersWrite code that would parse an expression that is similar to BASH brace expansion. Best illustrated with an example: the expression "(a,b,cy)n,m" would be parsed into an array of the following strings:
- demonix February 12, 2015
an
bn
cyn
m
You can assume that the input will always be valid.
Hint: the expression can nest. Therefore, "((a,b)o(m,n)p,b)" parses into:
aomp
aonp
bomp
bonp
b| Report Duplicate | Flag | PURGE
Google Software Engineer Intern String Manipulation - 2of 2 votes
AnswersGiven an array of integers, return true if there're 3 numbers adding up to zero (repetitions are allowed)
- fatenuller January 09, 2015 in United States
{10, -2, -1, 3} -> true
{10, -2, 1} -> true -2 + 1 +1 =0| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm - 2of 2 votes
AnswersPrint a BST such that it looks like a tree (with new lines and indentation, the way we see it in algorithms books).
- Ray December 22, 2014 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm - 2of 2 votes
AnswersWrite a function that takes the following inputs and gives the following outputs.
- forfron December 19, 2014 in United States
Input: A list of points in 2-dimensional space, and an integer k
Output: The k input points closest to (5, 5), using Euclidean distance
Example:
Input: {(-2, -4), (0, 0), (10, 15), (5, 6), (7, 8), (-10, -30)}, k = 2
Output: {(5, 6), (7, 8)}| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm - 0of 0 votes
AnswersImplement strcmp function of stdlib.h library without using any standard library.
- pbsureja December 19, 2014 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern C - 0of 0 votes
AnswersImplement a Singleton class in java? How will this help?
- pbsureja December 19, 2014 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer Intern Java - 0of 0 votes
AnswersThe latest reality show has hit the TV: “Cat vs. Dog”. In this show, a bunch of cats and dogs compete for the very prestigious Best Pet Ever title. In each episode, the cats and dogs get to show themselves off, after which the viewers vote on which pets should stay and which should be forced to leave the show.
- lxfuhuo December 17, 2014 in United States
Each viewer gets to cast a vote on two things: one pet which should be kept on the show, and one pet which should be thrown out. Also, based on the universal fact that everyone is either a cat lover (i.e. a dog hater) or a dog lover (i.e. a cat hater), it has been decided that each vote must name exactly one cat and exactly one dog.
Ingenious as they are, the producers have decided to use an advancement procedure which guarantees that as many viewers as possible will continue watching the show: the pets that get to stay will be chosen so as to maximize the number of viewers who get both their opinions satisfied. Write a program to calculate this maximum number of viewers.
Input
On the first line one positive number: the number of testcases, at most 100. After that per testcase:
One line with three integers c, d, v (1 ≤ c, d ≤ 100 and 0 ≤ v ≤ 500): the number of cats, dogs, and voters.
v lines with two pet identifiers each. The first is the pet that this voter wants to keep, the second is the pet that this voter wants to throw out. A pet identifier starts with one of the characters ‘C’ or ‘D’, indicating whether the pet is a cat or dog, respectively. The remaining part of the identifier is an integer giving the number of the pet (between 1 and c for cats, and between 1 and d for dogs). So for instance, “D42” indicates dog number 42.
Output
Per testcase:
One line with the maximum possible number of satisfied voters for the show.
Sample Input 1
2
1 1 2
C1 D1
D1 C1
1 2 4
C1 D1
C1 D1
C1 D2
D2 C1
Sample Output 1
1
3| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Algorithm - 4of 4 votes
AnswersGiven a list of strings, return a list of lists of strings that groups all anagrams.
- tirelative December 13, 2014 in United States
Ex. given {trees, bike, cars, steer, arcs}
return { {cars, arcs}, {bike}, {trees, steer} }
m = # of words
n = length of longest word
I solved this in O(m * n * log n) time.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm - 0of 0 votes
AnswersA server receives requests from different clients...each client send a Runnable job and time on which this job should be run. Write a java program that would accept these jobs and run each job at the required time. Hint: the solution should have a job priority queue to hold the jobs and it should be multithreaded. One thread should accept the tasks, the other one should run the jobs. Also conditions and signalling will be used
- koks2000 December 09, 2014 in United States| Report Duplicate | Flag | PURGE
Linkedin Software Engineer Intern Java Threads - 1of 1 vote
AnswersTake a list of integers (left to right order) and return an integer of the number of identical binary trees that can be created from the same list.
- A. December 04, 2014 in United States
Input: [10, 8, 15, 6, 9, 4, 5]
Output: 24
Input: [12, 6, 19, 15, 5]
Output: 6
Input: [44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64]
Output: 1
I wrote a brute-force 'solution', creating a binary tree for each permutation of the list (with the same root as Input list) and compared each to the binary tree from the Input list. For large input lists (length > 10), my 'solution' is useless.| Report Duplicate | Flag | PURGE
Software Engineer Intern Problem Solving Amazon Algorithm - 7of 7 votes
AnswersGiven an array of integers.
- Victor November 27, 2014 in United States
Move all non-zero elements to the left of all zero elements.| Report Duplicate | Flag | PURGE
Facebook Software Engineer Intern Algorithm