## Software Engineer Intern Interview Questions

- 0of 0 votes

AnswersGiven a

`struct drop{ float x_cordinate; float radius; }`

Return the number of calls that the function Drop() that returns a drop object, needs to be called so that the interval [0, 1) is covered. For each drop object the range covered are values on a line considering x_cordinate as center and radius as the length added on both sides of the x_cordinate on that line?

`int numCalls(const function<drop> Drop){ drop firstDrop = Drop(); // Code from here }`

For example, if the first Drop() call returns drop object drop.location as 0.5 (considering points on a 1d axis) and drop.radius as 0.2, then the interval covered is [0.3, 0.7). So how many calls need to be made to ensure the interval [0, 1) is covered. The location and radius can map to any real value.

- rahul January 21, 2019 in United States| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 1of 1 vote

Answersfind all numbers the sum of cube of each digits is the number itself

- Aamir November 09, 2018 in United States

ex:153=1^3+5^3+3^3| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

Answers# Given a dictionary, find all pairs of words that,

- nico.campolongo February 16, 2018

# when concatenated together, form a palindrome.

# ‘none', 'xenon': 'nonexenon' is a palindrome

# 'none', 'xexenon': 'nonexexenon' is a palindrome| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

AnswersLet's assume that we have a binary classification system that classifies sets of samples, the rules for the classification are:

- camilito200009 November 07, 2017 in United States

The set is 'GOOD' if ALL the samples are 'GOOD'

The set is 'BAD' if ANY sample in the set is 'BAD'

Based on this we receive an input that contains multiple lines, where each line represents the classification of a set of samples. The format of each line is

class,sample_id_1,sample_id_2,...,sample_id_n

where class will either be GOOD or BAD. The sample IDs represent the samples contained in the classified set.

Now, for generating the output response we have to consider three cases:

If a unique mapping of samples-to-class exists, we output the corresponding mapping (sorted by the samples IDs)

If no consistent sample-to-class is possible, we output the answer NO CONSISTENT

If more than one mapping would be consistent, we output the answer MULTIPLE MAPPING.

To better illustrate the problem, following there are 4 examples

Sample Input

GOOD,10,11

GOOD,11,12

GOOD,10,12

Sample Output

10,GOOD

11,GOOD

12,GOOD

Sample Input

GOOD,10,11

BAD,11,12

Sample Output

10,GOOD

11,GOOD

12,BAD

Sample Input

GOOD,10,11

BAD,11,12

GOOD,11,13

GOOD,12,13

Sample Output

NO CONSISTENT

Sample Input

BAD,10,11

BAD,11,12

Sample Output

MULTIPLE MAPPING

If someone knows how to solve the problem, even if it's just pseudocode I'd really appreciate it| Report Duplicate | Flag | PURGE

Councyl Software Engineer Intern - 1of 1 vote

AnswersYou are a game developer working on a game that randomly generates levels. A level is an undirected graph of rooms, each connected by doors. The player starts in one room, and there is a treasure in another room. Some doors are locked, and each lock is opened by a unique key. A room may contain one of those unique keys, or the treasure, or nothing.

- robert October 24, 2017 in United States

Implement a representation for a level and write code that, given a level and starting room, returns true if the treasure can be reached by the player—likely requiring them to find certain other keys first—or false if there is no solution.| Report Duplicate | Flag | PURGE

Google Software Engineer Intern Algorithm - 0of 0 votes

AnswersInsert node with a given value in a circular sorted linked list.

- sbdul May 10, 2017 in UK| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

AnswersGiven list of N points find the K closest points to origin i.e((0,0)).

- sbdul May 10, 2017 in UK| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

AnswersYou are given a positive integer number and you have to return the greatest smaller tidy number of this input number. If the input number itself is tidy, then, it become the answer

- sonesh April 20, 2017 in India

Example

Input: 1234

output: 1234

input: 100

output: 99

input 143456

output: 139999.

PS.A tidy number is a number whose digits are in non-decreasing order.| Report Duplicate | Flag | PURGE

FreshoKartz Software Engineer Intern Bit Manipulation - 0of 0 votes

AnswersYou are given a positive integer number and you have to return a boolean telling whether the input number is a tidy number or not. A tidy number is a number whose digits are in non-decreasing order. For example, 1234 is a tidy number, 122334 is also a tidy number but 143567 is not a tidy number.

- sonesh April 20, 2017 in India| Report Duplicate | Flag | PURGE

FreshoKartz Software Engineer Intern Bit Manipulation - 1of 1 vote

AnswersInterview Question: essentially given a bunch of sets in an array, print out the cross product of all of those sets

- ul December 22, 2016 in United States| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern - 0of 0 votes

AnswersYou are given a sorted list of distinct integers from 0 to 99, for instance [0, 1, 2, 50, 52, 75]. Your task is to produce a string that describes numbers missing from the list; in this case "3-49,51,53-74,76-99".

- Casper November 14, 2016 in United States

Examples:

[] “0-99”

[0] “1-99”

[3, 5] “0-2,4,6-99”| Report Duplicate | Flag | PURGE

Google Software Engineer Intern C++ - -1of 1 vote

AnswerAssume (n+1) points on a 2D space. You observe the points from (0,0) with viewing direction and viewing angle.

- Casper November 14, 2016 in United States

Given an array (xn,yn), and a viewing angle v (45 degree), find the direction that can observe max number of points.| Report Duplicate | Flag | PURGE

Google Software Engineer Intern C++ - 0of 0 votes

AnswersGiven a sorted array, and given a number n, find number of times n occurs in the array.

- bharos92 November 11, 2016 in United States for NSBU| Report Duplicate | Flag | PURGE

VMWare Inc Software Engineer Intern Algorithm - 1of 1 vote

AnswersYou have a matrix that is sorted as such: For each value, every index to its right and below it must be larger than the current space's value. Likewise, all entries to its left and above it must be smaller than the current value. How would you go about searching this matrix for a specific number, given its sorted nature?

- oxymoronic2012 November 02, 2016 in United States for Bing| Report Duplicate | Flag | PURGE

Microsoft Software Engineer Intern Matrix - 2of 2 votes

AnswersJust a disclaimer: I doubt you will ever get this interview question. My interviewer even started off by saying, "Hmm, well this isn't really fair, but..." So don't place too much stock in whether or not you can solve this.

- oxymoronic2012 November 02, 2016 in United States for Bing

Question: You have a group of pigs and buckets of food for said pigs. There are 1,000 buckets of food, and exactly 1 of them is poisoned. Your goal is to determine, by the end of 1 hour, which bucket is poisoned.

The poison takes 30 minutes to kill a pig, and you'd like to kill as few pigs as possible. The number of pigs you can test is limitless, and you can assign a number to each bucket and each pig so that you know exactly which pig ate from which bucket(s). You determine which buckets to feed to which pigs, but you have no timer and no way to guesstimate the time. What is the minimum number of pigs you need to use to solve the problem?| Report Duplicate | Flag | PURGE

Microsoft Software Engineer Intern Brain Teasers - 0of 0 votes

AnswersYou are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative, move backward n steps. Determine if there is a loop in this array.

- shreydesai@utexas.edu October 29, 2016 in United States

For example, given the array [2, -1, 1, 2, 2], index 0 maps to index 2, 1 maps to 0, 2 maps to 3, and so on. There is a loop in this array because 0 maps to 2, 2 maps to 3, and 3 maps to 0 (use the modulo operator).| Report Duplicate | Flag | PURGE

Microsoft Software Engineer Intern Arrays - 0of 0 votes

AnswersGiven an n-ary tree, find the longest sequence in it. The sequence doesn't end to start at the root. It can go from leaf to leaf.

- ul October 16, 2016 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer Intern Trees and Graphs - 1of 1 vote

AnswersMaximize the expression value which consists of numbers and +,- operators. Write a program using Greedy approach in linear complexity and Dynamic approach with O(n3) complexity.

- rahul123jadhaav March 26, 2016 in India| Report Duplicate | Flag | PURGE

Morgan Stanley Software Engineer Intern Coding - 0of 0 votes

AnswersStanford has to select a team of dodgeball players from its class of 2013. There are n students in the class and each student is identified by his/her student ID, which is between 1 and n. The coach has to select K players out of these n students for his team. But there is a twist, if among the K dodgeball players, a player's ID number evenly divides another player's ID number, then there is a high chance of them getting into a fight. The coach will do his best to select the K players so that no pair of players among them will want to fight one another. But if the game turns out to be very popular, this becomes impossible. Complete the function dodgeBall to return the minimum size of K at which it becomes impossible to choose a dodgeball team that has no fighting?

- vick4523zf March 22, 2016 in United States

Input Format:

One line of text, containing the size of the class of 2013, n

Constraints:

1 <= n <= 5,000,000,000

n is guaranteed to be an even number

Output Format:

The minimum size of K that guarantees the existence of 2 players who fight with each other in any K-sized subset of the class.

Sample Input:

4

Sample Output:

3

Explanation:

If the team = {1,2,3}: 1&2 or 1&3 can fight with each other

If the team = {1,3,4}: 1&3 or 1&4 can fight with each other

If the team = {2,3,4}: 2&4 can fight with each other

If K=2, then the teams {3,4} or {2,3} will have no fights. So 3 is the smallest value of K for which any K-sized team, must include a fighting pair.

Sample Input:

2

Sample Output:

2

Explanation:

The team = {1,2}: 1&2 can fight with each other| Report Duplicate | Flag | PURGE

Twitter Software Engineer Intern Algorithm C++ Computer Science - 0of 0 votes

Answersfind the best way to write zig zag sign change algorithm !

- bharadwajdya March 17, 2016 in United States| Report Duplicate | Flag | PURGE

Roxar Software Engineer Intern C - 4of 4 votes

AnswersGiven the root of a binary tree containing integers, print the columns of the tree in order with the nodes in each column printed top-to-bottom.

- takepwn February 26, 2016 in United States`Input: 6 / \ 3 4 / \ \ 5 1 0 / \ / 9 2 8 \ 7 Output: 9 5 3 2 6 1 7 4 8 0 Input: 1 / \ 2 3 / \ / \ 4 5 6 7 When two nodes share the same position (e.g. 5 and 6), they may be printed in either order: Output: 4 2 1 5 6 3 7 or: 4 2 1 6 5 3 7`

| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern Trees and Graphs - 2of 2 votes

Answers`|X XX | | X X | | X | | |`

X = land.

- HumbleLearner February 20, 2016 in United States

Empty space = Water.

Find the number of islands present. (Upto you how you want to represent land and water in the array above)

Answer for the above example: 3

I wish I could draw the diagram better!

Explanation: 3 because:

The three islands are:

X

X

X

XX

X| Report Duplicate | Flag | PURGE

Amazon Software Engineer Intern Algorithm - 1of 1 vote

AnswersGiven an input BST, find the minimum value difference between any two nodes in the tree.

- a.asudeh February 18, 2016 in United States

e.g:

....10

5 16

........12 20

answer: 2 (it happens between nodes 12 and 10)

describe the test cases you would use here?| Report Duplicate | Flag | PURGE

Google Software Engineer Intern - 0of 0 votes

AnswersGiven a specific type of DAG that forms a pyramid (the links have up-down direction), in which the node labels are integer, find the path that has the maximum sum of node values. what is the time/space complexity of the algorithm?

- a.asudeh February 18, 2016 in United States

e.g:

3

/ \

9 4

/ \ / \

1 8 2

/ \ / \ / \

4 5 8 2

answer: <3,9,8,8>, sum = 3+9+8+8=28| Report Duplicate | Flag | PURGE

Google Software Engineer Intern Algorithm - 2of 2 votes

AnswersGiven two arrays/Lists (choose whatever you want to) with sorted and non intersecting intervals. Merge them to get a new sorted non intersecting array/list.

- HumbleLearner February 12, 2016 in United States

Eg:

Given:

Arr1 = [3-11, 17-25, 58-73];

Arr2 = [6-18, 40-47];

Wanted:

Arr3 = [3-25, 40-47, 58-73];| Report Duplicate | Flag | PURGE

Facebook Software Engineer Intern Algorithm - 0of 0 votes

AnswersGive java code that takes an instance of the stable marriage problem as input and decides if there is { exactly one} stable matching for this instance (that is, the program outputs either ``unique stable matching'', or ``more than one stable matching'').

- ritikashah017 February 06, 2016 in United States

input:

3

0 1 2

1 0 2

0 1 2

1 0 2

0 1 2

0 1 2

Output:

more than one stable matching| Report Duplicate | Flag | PURGE

Intuit Software Engineer Intern Algorithm - 2of 2 votes

Answersfind the maximum depth in a binary tree.

- pooja January 31, 2016 in United States| Report Duplicate | Flag | PURGE

Amazon Software Engineer Intern - -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

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window