Software Developer Interview Questions
- 0of 0 votes
AnswersHow Solr/Lucene or Elasticsearch work? For what purpose are they used?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Large Scale Computing SQL - 0of 0 votes
AnswersWhat's Hbase, Pig, used for? Why do we need Hbase if we can use Hive to query Hadoop?
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Distributed Computing Experience Java Knowledge Based Large Scale Computing - 0of 0 votes
AnswersWhat are different phases of Map reduce operation - I think they were looking for split, combiners, partitioners, sorting phases of whole map reduce stage.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Distributed Computing Java Large Scale Computing SQL - 0of 0 votes
AnswersMy interview was for big data position for their Search team. They were looking for person with good Hadoop skill set :-
- Tom Walker June 07, 2015 in United States
1. Can you describe Hadoop Architecture? What are various components of it (Primary/Secondary namednodes, data node etc)? Explain working of each.| Report Duplicate | Flag | PURGE
Microsoft Software Developer Data Mining Data Structures Database Distributed Computing Ideas Java - 0of 0 votes
AnswersString encoding-decoding question. Given a digit sequence, return no. of ways it can be decoded.
- Tom Walker June 07, 2015 in United States
Mapping : A->1, B->2, Z->26
For ex : Given a string "123", based on the mapping it can be decoded to following ways :-
(1) 1,2,3 -> A,B,C (2) 12,3 -> L,C (3) 1,23 -> A,W| Report Duplicate | Flag | PURGE
Groupon Software Developer - 0of 0 votes
AnswersWhat is REST? Can you explain it by giving examples.
- Tom Walker June 07, 2015 in United States| Report Duplicate | Flag | PURGE
Groupon Software Developer - 2of 4 votes
AnswersDescription
- programming.kingdom June 07, 2015 in United States
A prospective CS student is investigating how many semesters it will take to graduate from a variety of different universities. Each university provides a list of required courses, their prerequisites, and when each course is offered. Given this information, determine the minimum number of semesters to graduate.
Consider the following example. A student is required to take 4 courses, mt42, cs123, cs456, and cs789. mt42 is only offered in the fall semester and has no prerequisites. Similarly, cs123 is only offered in the spring semester and has no prerequisites. cs456 is only offered in the spring semester and has both cs123 and mt42 as prerequisites. Finally, cs789 is offered in both fall and spring and has cs456 as its only prerequisite. The shortest time to graduate is 5 semesters, by taking mt42 in the fall, cs123 in the next spring, cs456 the following spring (since it is not offered in the fall) and finally cs789 the following fall.
For this problem, there are only two semesters, fall and spring. Always start counting semesters from the fall.
In addition to the fall/spring scheduling issues, there is one slight complication. In order to keep the dormitories full, each university limits the number of courses that can be taken in any semester. This limit appears as part of the input data. The third example below illustrates this issue.
Input
There are one to twenty-five data sets, followed by a final line containing only the integers -1 -1. A data set starts with a line containing two positive integers n, 1 <= n <= 12, which is the number of courses in this data set and m, 2 <= m <= 6, which is the maximum number of courses that can be taken in any single semester. The next line contains the n course identifiers. Each is a 1-5 character string from the set {a-z, 0-9}. Following the course identifiers is the individual course information. This consists of n lines, one line for each course, containing the course identifier, semester offered ('F'=Fall, 'S'=Spring, 'B'=Both semesters), the number of prerequisite courses, p, 0 <= p <= 5, and finally p prerequisite course identifiers. The first example data set below corresponds to the problem described above.
Output
The output contains one line for each data set, formatted as shown in the sample output.
Sample Input
4 6
cs123 mt42 cs456 cs789
mt42 F 0
cs123 S 0
cs456 S 2 cs123 mt42
cs789 B 1 cs456
3 6
math1 comp2 comp3
comp3 S 1 comp2
math1 S 0
comp2 F 1 math1
4 3
m10 m20 c33 c44
m10 B 0
m20 B 0
c33 B 0
c44 B 0
-1 -1
Sample Output
The minimum number of semesters required to graduate is 5.
The minimum number of semesters required to graduate is 4.
The minimum number of semesters required to graduate is 2.| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - -1of 1 vote
AnswersHow to register new classes in factory pattern ?
- jkl May 30, 2015 in India| Report Duplicate | Flag | PURGE
Tricon Software Developer C++ - 1of 1 vote
Answerswrite a merge sort algorithm to sort a file which can't be loaded into the memory. Assume you can only load 10 items in the memory at a time and there are 100 items to sort.
- ajrules2105 May 09, 2015 in United States for big data| Report Duplicate | Flag | PURGE
Intel Software Developer Algorithm - 0of 0 votes
AnswersWhich structure can be used to return the lastly added node and remove it from the collection and also will allow to peek the highest valued node without removing it from the collection. What is the time and space complexity for Push, Pop and Peek actions
- A3Clef May 08, 2015 in United States| Report Duplicate | Flag | PURGE
unknown Software Developer Data Structures - 0of 0 votes
AnswersFind first duplicate in an array where:
- AP May 02, 2015 in United States
Array has N integers ranging from 0 to n-1.
(Multiple elements can be duplicated multiple times)
in time complexity O(n) and space complexity O(1)| Report Duplicate | Flag | PURGE
Software Developer Algorithm - 0of 0 votes
AnswersGLaDOS is feeling bored, so she decided to come up with a board game. The game is as follows. There is
- glory for dreams April 24, 2015 in India
board of dimension n x n (2 <= n <= 10). Each position in this board is either a 0 or a power of 2, between 2
and 2048. Once the board is set up, there are only two moves allowed - move all left or move all right.
The way move all left works is as follows:
For every row on the board, starting from the rightmost position each element is moved to its left. An
element with a zero value does not move. An element with non-zero value can move to its left if the value of
the element to its left is a 0 or has the same value as the current element.
In case, the element to the left is 0 then the element and 0 swap positions i.e., 4 0 0 4 would become 4 0 4 0
In case, the element to the left has the same value as the current element then the left element combines
with its right element and creates an element with double the value in place of the right element and leaves
a 0 in its current place. For e.g., 2 2 would become 4 0 or 2 2 2 2 would become 4 0 4 0.
The combining operation can cause a cascading operation i.e., if the new element created has the same
value as the element to its left, it can combine again.
For e.g., if a row had 8 4 2 2, move left would combine 2 and 2 to form 4 leading to 8 4 4 0. Now, it is
possible to combine further as the element to the left of 4 has the same value, thus after the second
combine, the row would be 8 8 0 0. And again 8 and 8 would form a 16. Thus the final values in the row
would be 16 0 0 0.
But if the row was 8 4 2 0 2, then moving left would result in 8 4 2 2 0. The cascading operation is allowed
only after a combination operation, There would no cascading operation if the element is swapped with 0.
Similar rules apply for move all right, wherein for every row elements starting from the leftmost position
move to their right.
You can either choose move all left or move all right operation but not both. Now given a state of the board,
you have determine what will be the maximum value on the board after either move all left or move all right.
Example
3
2 2 0
2 2 4
2 0 2
Move all left would result in:
4 0 0
4 0 4
2 2 0
The maximum value on the board after this move is 4.
Move all right would result in:
0 4 0
0 0 8
0 2 2
In the first row, 2 and 2 combines to form 4. In the second row, left most 2 combines with 2 to form 4. As the
element to its right has a value 4, combination operation cascades to form 8.
The maximum value on the board after this move is 8.
Now of the two operations, the higher of the two maximum values is 8. Thus the expected output is 8.
Input
3
2 2 0
2 2 4
2 0 2
Output
8
Input
3
0 0 4
0 2 2
0 4 8
Output
8
Time limit per test case:
1 second(s)| Report Duplicate | Flag | PURGE
National Instruments Software Developer C C++ - 0of 0 votes
Answersgiven an array with elements check if just by exchanging two elements of the array we get a sorted array.
- sandeep.nie April 22, 2015 in United States
time restriction:
O(NlogN)
space restriction: 2N| Report Duplicate | Flag | PURGE
Amazon Software Developer Arrays - 0of 0 votes
AnswersAssuming you have a binary tree which stores integers, count the number of nodes whose value is lower than the value of its upper nodes.
- sandeep.nie April 22, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm Trees and Graphs - 1of 1 vote
Answers
- sakshisharma April 03, 2015 in United Statespublic interface Triangle { /** * Three segments of lengths A, B, C form a triangle iff * * A + B > C * B + C > A * A + C > B * * e.g. * 6, 4, 5 can form a triangle * 10, 2, 7 can't * * Given a list of segments lengths algorithm should find at least one triplet of segments that form a triangle (if any). * * Method should return an array of either: * - 3 elements: segments that form a triangle (i.e. satisfy the condition above) * - empty array if there are no such segments */ int[] getTriangleSides(int[] segments); }
| Report Duplicate | Flag | PURGE
Linkedin Software Developer Algorithm - 6of 6 votes
AnswersGiven an array such that every next element differs from the previous by +/- 1. (i.e. a[i+1] = a[i] +/-1 ) Find the local max OR min in O(1) time. The interviewer mentioned one more condition that the min or max should be non-edge elements of the array
- xyz March 30, 2015 in United States
Example: 1 2 3 4 5 4 3 2 1 -> Local max is 5
1 2 3 4 5 -> No local max or min exists
5 4 3 2 1 -> No local max or min exists| Report Duplicate | Flag | PURGE
Facebook Software Developer Algorithm - 0of 2 votes
AnswersPrint all the different possible subsets suming the given number
- guysackman21 March 21, 2015 in India
Ex:
Input:4
Output:
1111
112
121
112
13
31| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 1of 1 vote
AnswersWrite a method that takes the root of a tree as input and check if the tree is a Binary Search Tree (BST).
- nikamirulmukmeen March 19, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Developer Algorithm - 1of 1 vote
AnswersGiven a sorted array of integers, using the same array, shuffle the integers to have unique elements and return the index.
- nikamirulmukmeen March 19, 2015 in United States
Sample input : [3, 3, 4, 5, 5, 6, 7, 7, 7]
Sample output : [3, 4, 5, 6, 7, X, X, X, X]
In this case, it returns an index of 4.
The elements in the array after that index is negligible (don't care what value it is).| Report Duplicate | Flag | PURGE
Bloomberg LP Software Developer Problem Solving - 0of 0 votes
AnswersThere are 3 romms in which party is going on lets say room A, B, C. Guests are coming one by one and you have to tell the guest
- swastikSoft March 14, 2015 in United States
which room to enter. At any point of time each room has to maintain a percentage Lets say the percentage that each room has to maintain is
A- 20% , B-30% , C- 50%. You can maintain total count of each room and keep on adding count to respective room as the new guest enters each room.
How would you go about it. What formula would you use.
Give a generalise formula so that it works if no. of rooms increase.| Report Duplicate | Flag | PURGE
Facebook Software Developer Algorithm - 1of 1 vote
AnswersYou are tasked with implementing a method that returns the lowest possible number that could be generated after removing n characters from a string of digits. The method signature should look like:
public static string GenerateLowestNumber(string number, int n)
Where the number parameter is a string that contains a number (e.g. “4205123”), and the n parameter represents the number of characters to remove from the string. The goal of this method is to return the lowest number that can be generated by removing n characters from the number provided while keeping the positions of the remaining characters relative to each other the same (i.e. the method should remove n characters from the string, but it cannot re-order the characters).
- JSDUDE March 14, 2015 in United States for Cloud + Enterprise
For example, if number is “4205123” and n is 4, the lowest possible number that can be generated after removing any 4 characters is “012”. If number is “216504” and n is 3, the lowest possible number that can be generated after removing 3 characters is “104”.| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm String Manipulation - 0of 0 votes
AnswersIdentify the flaws / limitations in the following ConvertToNumber method:
- JSDUDE March 14, 2015 in United States for Cloud + Enterprisepublic static bool ConvertToNumber(string str) { bool canConvert = false; try { int n = Int16.Parse(str); if (n != 0) { canConvert = true; } } catch (Exception ex) { } bool retval = false; if (canConvert == true) { retval = true; } return retval; }
| Report Duplicate | Flag | PURGE
Microsoft Software Developer Debugging - 0of 0 votes
AnswersYou are tasked with migrating data between two systems that store movie metadata. The first system, which you are to use as input, keeps their movie metadata in the following structure:
MovieName ContributorType ContributorName
Pulp Fiction Director Quentin Tarantino
Pulp Fiction Actor John Travolta
Pulp Fiction Actor Samuel L. Jackson
Titanic Director James Cameron
The second system, which you are to output to, uses the following object for movie information:class MovieInformation { public string Name { get; set; } public string Director { get; set; } public List<string> Actors { get; set; } }
The first system provides an IDataReader that lets you access their data. Their data is always sorted on MovieName. You can call Read on the IDataReader to move the cursor to the next entry, and you can call GetString on the IDataReader to get the movie name, contributor type, and contributor name. For example, with the above data, if you were to call:
MovieDataReader dataReader = new MovieDataReader(); int movieNameOrdinal = dataReader.GetOrdinal( "MovieName" ); int contributorTypeOrdinal = dataReader.GetOrdinal( "ContributorType" ); int contributorNameOrdinal = dataReader.GetOrdinal( "ContributorName" ); while ( dataReader.Read() ) { string movieName = dataReader.GetString( movieNameOrdinal ); string contributorType = dataReader.GetString( contributorTypeOrdinal ); string contributorName = dataReader.GetString( contributorNameOrdinal ); }
Then at the end of the first iteration of this while loop, movieName would be “Pulp Fiction”, contributorType would be “Director” and contributorName would be “Quentin Tarantino”.
The second system provides a single method for posting movie information to their DB. This method should only ever be called once per movie:class MovieInformationDatabase { public void SaveMovieInformation( MovieInformation information ) { } }
Implement a method that migrates all of the data from the first system to the second system
- JSDUDE March 14, 2015 in United States for Cloud + Enterprise| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm - 0of 0 votes
AnswersPrint the following pattern using C/C++
- deepanshuchg March 14, 2015 in India
(For n=4)
1
2*3
4*5*6
7*8*9*10
7*8*9*10
4*5*6
2*3
1
PS: Printing above triangle is easy and I easily did it, but couldn't print the lower triangle.| Report Duplicate | Flag | PURGE
Josh Software Developer C++ - 3of 5 votes
AnswersProblem Statement
- nirajkantsinha March 13, 2015 in United States
Diameter
The diameter of a graph is the maximum shortest path between any two nodes.
At the beginning, there is a simple grpah contains exactly 1 node. Then we add new nodes one by one to the graph. Each time when we add a new node to the graph, we also add exactly one edge to connect this node to another node which already exists.
We want to find the diameter of the graph each time we add a new node. Note that each edge cost 1.
Input Format:
First line of the input contains one integer N, indicating how many new nodes we will add.
Then following N lines. The ith line contains an integer X, which means we add the ith node and an edge connecting the Xth node and ith node.
The original node is the 0th node.
Output Format:
Output N lines. The ith line is an integer indicating the diameter of the graph after adding the ith node.
Constraints:
0 < N <= 100000
0 <= Xi < i
i is counting from 1
Sample Input:
5
0
0
1
1
1
Sample Output:
1
2
3
3
3
Explanation:
Firstly the graph contains only node 0. The first line of output is 1 because the diameter becomes 1 when node 1 is added and connected to node 0. Diameter becomes 2 after adding node 2 to node 0. Then adding node 3, 4, 5, all of them are connecting to node 1, caculate the shortest path of all pairs of nodes, the maximum shortest path is 3, so the last 3 lines of output are all 3.| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 2 votes
AnswersWrite algorthim to determine the total time to make ice cream and when it leaves the store.
- google_me_honey March 12, 2015 in United States
Consist of an order time, order number, and ice cream type.
“ice cream Type” is an integer: 0 for combo, 1 for vanilla. Order numbers are increasing.
We have three machines for making ice creams.
It takes 45 seconds to make a combo ice cream and 15 for vanilla. Can only make one ice cream at a time.
Need to determine total time to make ice cream and time the ice cream leaves the store (delivered).
In: order_time,order_num,ice_cream_type
Out: order_num,depart_time,total_time| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - -5of 5 votes
AnswersN*N matrix having various alphabets in different cells is given. Also a word is given. You have to find the position of this word in the given matrix. Please refer to other posts for details.
- aj13 March 11, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - -4of 4 votes
AnswerWrite a function to determine whether a given number is colorful or not?
- aj13 March 11, 2015 in United States
Please refer to other questions other posts with same question for details. They have mentioned the details quite clearly.
Here is the link to the question:
http://www.careercup.com/question?id=5725158532710400| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - 1of 1 vote
AnswersThe Mingo game:
- ram March 10, 2015 in United States
The game of Mingo involves a 100 X 100 board with unique positive whole numbers in the range from 1 to 1,000,000 randomly distributed in the cells. Unique numbers are "called" one at a time and the goal is to have a "Mingo", which is an entire row or column of cells with numbers that have been called; one might also form a diagonal from corner to corner with numbers that have been called. Write a function that takes as parameters a square array of 100 X 100 positive whole numbers and list of "called" numbers. Your function will report whether a "Mingo" occurs, and after how many called numbers the first Mingo occurs. You may assume valid input.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Matrix