Senior Software Development Engineer Interview Questions
- 3of 3 votes
AnswersGiven the following set of strings, write a function that stores this information.
- JSDUDE April 19, 2017 in United States
// /Electronics/Computers/Graphics Cards
// /Electronics/Computers/Graphics Cards
// /Electronics/Computers/SSDs
// /Electronics/Computers/Graphics Cards
// /Electronics/Computers/SSDs
// /Electronics/TVs
// /Electronics/Computers/Graphics Cards
// /Electronics/TVs
// /Electronics/TVs
// /Garden
// /Automotive/Parts
Your datastructure should be able to provide information as such:
// / = 11
// /Electronics = 9
// /Electronics/Computers = 6
// /Electronics/Computers/Graphics Cards = 4
// /Electronics/TVs = 3
// etc
// ["/Electronics/Computers/Graphics Cards", "/Garden"]| Report Duplicate | Flag | PURGE
NVIDIA Senior Software Development Engineer Data Structures Trees and Graphs - 8of 8 votes
AnswersConsider 10 years down the line we have a mobile device which have 10 TB hard disk.Consider the device a file of 5TB and RAM on the device is 1GB. How will you sort the file of 5TB. You can use extra space but RAM is 1GB which is used by other application on the device also.
- Utsav April 18, 2017 in India| Report Duplicate | Flag | PURGE
Morgan Stanley Senior Software Development Engineer - 0of 0 votes
AnswersWrite a Program in Java, You have an Employee class |
- Utsav April 09, 2017 in India
class Employee{
String name;
Integer id,
Employee manager
}
Each employee has a manager and the manager of CEO is null. Find all direct and indirect reportees of a manager.
Eg. Say Employee e1 reports to CEO,
e2 and e3 reports to e1,
e4 and e5 reports to e2,
e6 reports to e3.
Then by giving e1 as input, output should be e2, e3, e4, e5 and e6.| Report Duplicate | Flag | PURGE
Morgan Stanley Senior Software Development Engineer Java - 0of 0 votes
Answers/**
* A tournament tree is a binary tree
* where the parent is the minimum of the two children.
* Given a tournament tree find the second minimum value in the tree.
* A node in the tree will always have 2 or 0 children.
* Also all leaves will have distinct and unique values.
* 2
* / \
* 2 3
* / \ | \
* 4 2 5 3
*
* In this given tree the answer is 3.
*/
- lkpunisher April 05, 2017 in United Statesclass Node { Integer value; Node left, right; Node(Integer value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } } class Solution { /** * This should return the second minimum * int value in the given tournament tree */ public static Integer secondMin(Node root) { } }
| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Trees and Graphs - 0of 0 votes
AnswersGiven a number n that represents n lockers and n students. All lockers start closed. First student goes and opens all the lockers. Second goes and toggles 2nd, 4th, 6th.. lockers. Third student toggles 3rd, 6th, 9th.. lockers. Print the lockers that remain open after all students pass.
- lkpunisher April 05, 2017 in United Statespublic void lockers(int n) { // Implementation here }
| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Math & Computation - 0of 0 votes
AnswersGiven 3 sorted arrays. Find(x,y,z), (where x is from 1st array, y is from 2nd array, and z is from 3rd array), such that x<y<z.
x = element(s) from array 1
y= element(s) from array 2
z = element(s) from array 3
I can have more than 1 elements from each array. But at least 1 from each array is mandatory and elements from .int[] arr1 = {3}; int[] arr2 = {11, 13, 16}; int[] arr3 = {45}; Correct Output : 7 (3,11,45) (3,13,45) (3,13,16,45) (3,16,45) (3,11,13,45) (3,11,16,45) (3,11,13,16,45)
Need to find the number of such sequences.
- manishasharma361 February 26, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersYou have two servers. Both of these servers have an identical file with billion characters except for one single character. These servers are connected over a very slow connection.
- xankar February 15, 2017 in United States
How do you find the different character?
My ans: split those files in to batches of characters of 10,000 (say), now calculate checksum and compare the checksums for the chunks of 10,000 character lines. So now you are just comparing 'ints' and not the files per say. (remember the connection is very slow)
His question: How do you optimize this?| Report Duplicate | Flag | PURGE
VMWare Inc Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersWrite a Java Program in which a class takes four integer arguments as input(a, b, c and d). Do addition of (a+b) on one thread, addition of (c+d) on another thread and multiplication of(a+b) * (c+d)) on main thread.
- Utsav February 06, 2017 in United States
Like: Thread1 = (a+b)
Thread2 = (c+d)
Main Thread = (Thread1 * Thread2)| Report Duplicate | Flag | PURGE
JP Morgan Senior Software Development Engineer Java - -1of 1 vote
AnswersGiven a few pairs of names in the order child, father. The input is a person name and level number. The output should be the number of children in that particular level for the person given.
- bharadwajdaya December 19, 2016 in India for Theriyathu
Example:
Input:
[
{Ram, Syam},
{Akil, Syam},
{Nikil, Ram},
{Subhash, Ram},
{Karthik, Akil}
];
Syam 2
Output: 3 (Syam has Ram and Akil in level 1 and in level 2 he have Nikil, Subhash, Karthik. So the answer is 3).| Report Duplicate | Flag | PURGE
Zoho Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersCreate a RESTful microservice that implements a card shuffling algorithm, as defined below. Should have evidence of test-driven development with unit tests. Use best practices of interfaces and generics for abstraction, preferably implementing a strategy pattern for deploy-time dependency injection of a shuffling algorithm.
- dbs.tkg December 11, 2016 in United States
Requirements:
· Create a microservice that stores and shuffles card decks.
· A card may be represented as a simple string such as “5-heart”, or “K-spade”.
· A deck is an ordered list of 52 standard playing cards.
· Expose a RESTful interface that allows a user to:
· PUT an idempotent request for the creation of a new named deck. New decks are created in some initial sorted order.
· POST a request to shuffle an existing named deck.
· GET a list of the current decks persisted in the service.
· GET a named deck in its current sorted/shuffled order.
· DELETE a named deck.
· Design your own data and API structure(s) for the deck.
· Persist the decks in-memory only, but stub the persistence layer such that it can be later upgraded to a durable datastore.
· Implement a simple shuffling algorithm that simply randomizes the deck in-place.
· Implement a more complex algorithm that simulates hand-shuffling, i.e. splitting the deck in half and interleaving the two halves, repeating the process multiple times.
· Allow switching the algorithms at deploy-time only via configuration.| Report Duplicate | Flag | PURGE
N/A Senior Software Development Engineer Java Object Oriented Design - 0of 0 votes
Answerspublic interface FirstCommonAncestor {
/**
* Given two nodes of a tree,
* method should return the deepest common ancestor of those nodes.
*
* A
* / \
* B C
* / \ \
* D E H
* / \
* G F
*
* commonAncestor(D, F) = B
* commonAncestor(C, G) = A
* commonAncestor(E, B) = B
*/
Node commonAncestor(Node one, Node two);
}
- BeingUpfront December 01, 2016 in United Statesclass Node { final Node parent; final Node left; final Node right; public Node(Node parent, Node left, Node right) { this.parent = parent; this.left = left; this.right = right; } boolean isRoot() { return parent == null; } }
| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Data Structures - 0of 0 votes
AnswersWith given Binary Tree below, traverse the tree and print the tree from bottom up order
- gekko November 09, 2016 in United States for Amazon Digital Ad
1
/ \
2 3
/\ /\
4 5 6 7
output: 4567231
Hint: the traverse is called "Level Order Tree Traversal"
I hope someone memorize this traversal and pass the exam and all these companies judging canditates with one algorithm could think they hired the best canditate.| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer - 1of 1 vote
Answersdetermine whether a word is in a stored list;
- kanukadze October 18, 2016 in United States
the list doesn't fit into memory;
no disk access allowed, for lookups, memory access only;
no false positives allowed, false negatives ok| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersDesign a service to generate unique 64 bit IDs
- kanukadze October 18, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer System Design - 0of 0 votes
AnswersWrite a code to convert from long type time to date using java?
- sambasivareddy.s October 15, 2016 in United States
Eg: 324561092314 to 02/20/2015| Report Duplicate | Flag | PURGE
Intuit Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersWrite a code to find index of integer item in an integer array using java? Note : Complexity should be less than O(n) or with out using any for loop.
- sambasivareddy.s October 15, 2016 in United States| Report Duplicate | Flag | PURGE
Intuit Senior Software Development Engineer Algorithm - 3of 3 votes
AnswersGiven an array of 1 billion numbers with just a few 100 missing, find all the missing numbers. you have only enough memory to store only 10k elements
- PS October 07, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersYou are designing the client side of a Survey website. Provide the list of classes and methods you will use to break the problem down. Also, provide the API interaction with server.
- andy.r.nathan September 18, 2016 in United States| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Object Oriented Design - -1of 1 vote
AnswersYou are given the arrival and departure times of airplanes at an airport for a single day. Schedules for the airplanes remain the same across all days. You are to determine the number of gates the airport should have so that no plane spends time waiting for a gate.
- funktional September 12, 2016 in United States for AWS
arr = [9:30, 11:15, 16:30]
dep = [11:45, 11:30, 16:45]
Arr array is sorted by time. And departure array is sorted by corresponding arrival times. Plane 'i' arrives at time arr[i] and departs at time dep[i]
Notes:
After some questions, it was decided that minute was the smallest unit of time we cared about. Gate was considered occupied on the arriving minute, but empty on the departing minute. And that the arrival and departure times could be represented as such as integers. e.g. Day runs from minute 0 to minute 1339 (since using a zero-based index). So our example times represented as:
arr = [570, 675, 990]
dept = [705, 690, 1005]| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Coding - 0of 0 votes
AnswersGiven a list L of numbers from 0 to n, and another number k = [0-9], find how many times k appears in L. If the target number in L is more than one digit, treat each digit separately. For example, k=0 appears twice in L = [0,10].
- / September 05, 2016 in Canada| Report Duplicate | Flag | PURGE
TalkIQ Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersTwo friends Kohli and Dhoni want to test their friendship to check how compatible they are. Given a list of n movies numbered 1,2,3....n and asked both of them to rank the movies.
- abhibhagia August 07, 2016 in India
Design an algorithm to find compatibility difference between them.
Compatibility difference is the number of mis-matches in the relative rankings of the same movie given by them i.e. if Kohli ranks Movie 3 before Movie 2 and Dhoni ranks Movie 2 before Movie 3 then its a relative ranking mis-match Compatibility difference is the maximum number of mis-matches
Sample Input
5
31245
32415
Sample Output
2
Explanation
Movies are 1,2,3,4,5. Kohli ranks them 3,1,2,4,5, Dhoni ranks them 3,2,4,1,5. Compatibility difference is 2 because Kohli ranks movie 1 before 2,4 but Dhoni ranks it after.| Report Duplicate | Flag | PURGE
Walmart Labs Senior Software Development Engineer Arrays - 2of 2 votes
AnswersSwap the elements in Kth position from the start and end of a link list.
- Aussie July 27, 2016 in United States
ex:
input: list: 1,2,4,5,7,8 & K=2
output: 1,7,4,5,2,8| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Algorithm - 2of 2 votes
AnswersBasic background questions, describe a situation where you proposed a design and it was opposed. What did you do to convince people that your design was sound. Describe a situation where something you suggested resulted in improved process or caused a big positive impact on the company, etc.
- palak.chokshi July 01, 2016 in United States| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Experience - 0of 0 votes
AnswersImplement a TwoSum interface that has 2 methods: Store and Test. Store adds an integer to an internal data store and Test checks if an integer passed to Test is the sum of any two integers in the internal data store. Once you provide an answer interviewer will ask the O complexity of the solution and ask you to optimize it.
I provided 2 solutions, one with O(n-square) and another O(n). However the O(n) solution used 2 internal data stores. I was asked to preserve O(n) but not use the second internal store
- palak.chokshi July 01, 2016 in United Statespublic interface TwoSum { /* * Stores input in an internal data structure. */ public void Store(int input); /* * Returns true if there is any pair of numbers in the internal data structure which * have sum val, and false otherwise. * For example, if the numbers 1, -2, 3, and 6 had been stored, * the method should return true for 4, -1, and 9, but false for 10, 5, and 0 */ public bool Test(int val); } public class TwoSumImpl : TwoSum { private List<int> _store = new List<int>(); private List<int> _sums = new List<int>(); public void TwoSumImp() { } //-3,-2,3,5,7 //-5,0,1,-2,-3,8, public void Store(int input) { if(!_store.Contains(input)) { _store.Add(input); } } public bool Test(int val) { for(int i=0; i<_store.Count;i++) { if(_store[i] < 0) //store[i] is negative { diff = val + Math.Abs(_store[i]); if(_store.Contains(diff)) { return true; } } else //store[i] is positive { diff = val - _store[i]; if(_store.Contains(diff)) { return true; } return false; } } }
| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersGiven an integer array A of size N. Find the number of increasing sub-sequences of this array with length >= 1 and GCD = 1.
- abhibhagia June 26, 2016 in India
A sub-sequence of an array is obtained by deleting some (or none) elements and maintaining the relative order of the rest of the elements.
Example:-
[1] = 1
[1,2] = 2
[1,2,3] = 5| Report Duplicate | Flag | PURGE
ThoughtWorks Senior Software Development Engineer Dynamic Programming - 0of 0 votes
AnswersThere is a famous algorithm on geeksforgeeks to specify the minimum number of insertions to convert a string to palindrome.
- guptasunny158 June 22, 2016 in India
http://www.geeksforgeeks.org/dynamic-programming-set-28-minimum-insertions-to-form-a-palindrome/
But the question that was asked to me was one step ahead, interviewer asked to tell the characters that need to be appended to the string to make it a palindrome.| Report Duplicate | Flag | PURGE
Snapdeal Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersLRU Cache
- anonymous May 03, 2016 in United States| Report Duplicate | Flag | PURGE
Uber Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersWAP to take one element from each of the array add it to the target sum. Print all those three-element combinations.
- xankar April 28, 2016 in United States
/*
A = [1, 2, 3, 3]
B = [2, 3, 3, 4]
C = [1, 2, 2, 2]
target = 7
*/
Result:
[[1, 2, 4], [1, 3, 3], [1, 3, 3], [1, 3, 3], [1, 3, 3], [1, 4, 2], [2, 2, 3], [2, 2, 3], [2, 3, 2], [2, 3, 2], [3, 2, 2], [3, 2, 2]]| Report Duplicate | Flag | PURGE
Uber Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersFind the anagrams from a list of strings
- coder145 April 19, 2016 in United States
Input : {"tea", "ate", "eat", "apple", "java", "vaja", "cut", "utc"}
Output : {"tea", "ate", "eat","java", "vaja", "cut", "utc"}| Report Duplicate | Flag | PURGE
Twitter Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersYou are given an scenario where there is an Worker object. Each Worker object has one mandatory field unique id workerId and their are few other non unique and not mandatory Ids : DeptId and UnitID.
- CareerCupUser1 April 16, 2016 in United States
Design an cache for your Worker objects considering the fact that most of the queries on your cache will be on unitId. If the there is an query for an Worker which is not available in your cache then that data will be fetched from the server.
Design an cache such that there will be minimum number of server calls. Imagine there are 100;s of such non unique ids non mandatory Ids in the Worker object and you have to design the cache so that your client can query on any given id with minimum calls to server.
Your Worker object looks like this:
Worker1=> workerid=1, deptId=>765, unitId=>123 Name=“” Surname=“” Data=“”
Worker2=> workerid=2 , deptId=>765 Name=“” Surname=“” Data=“”
Worker3=> workerid=3, unitid=>123 Name=“” Surname=“” Data=“”
so when your client queries using unitId getWorkersbyUnitId(123) it should return Worker1 and Worker3.
If query is on deptId 765 then it should return Worker1 and Worker2
You can assume there is never an query on individual workerId.
other information given while discussion is you can query the server using any id and all the worker objects of that id will be fetched by that single call: Example there are 10 workers associated with untId: 99 then server call to getserverUnitIdWorkers(99)-> will output list of 10 workers. Each unitId or any other non mandatory id has approximate 8 to 10 workers associated with it. And there are millions of such unitIds.| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer Cache