Problem Solving Interview Questions
- 0of 0 votes
AnswersNot sure what topic this falls under.
- moriarty.rj June 30, 2015 in United States
"Improve metrics on the system."
Intentionally vague requirement to see how I ask questions. In my case, it ended up being a discussion about making database queries faster.| Report Duplicate | Flag | PURGE
Amazon Software Developer Database Ideas Problem Solving System Design - -1of 1 vote
AnswersYou are a prince of the kingdom of Kireet.
- tubelight March 22, 2015 in United States
You are handsome and brave.
While you are studying in London, you fall in love with a girl who turns out to be a princess of Tikrit.
The term ends and you return home.
Somehow it becomes public that you the prince of Kireet is in love with the princess of Tikrit.
The kingdoms of Kireet and Tikrit are enemies since time immemorial.
A prince of Kireet taking a Tikrit princess as bride is something unheard of.
The princess is forced not to leave Tikrit.
Your job is to rescue the princess.
However, there are certain conditions that you should be aware of before you embark upon this journey.
You know that the princess is somewhere in the city of Bagore, the capital of Tikrit.
You know that she uses a smartphone.
But, her phone number is changed and you don't know the new number.
You have been removed from her contact list in facebook and your account blocked.
However, she is able to receive and read all your mails on gmail and your messages on facebook through your other facebook account.
But her firewall blocks her every attempt to reply to your mail/message.
Only her closest friends know of her where-abouts and they are asked not to divulge this information to anyone who asks for it.
However, you were able to hack into her school website and get the emails and phone numbers of some of her friends.
You even know the phone number of her father and the location of palace is known to all.
But you know that she may not be in the palace.
You somehow manage to sneak into Bagore.
Once there, you are totally anonymous. Nobody knows who you really are.
Your job is to find out the where the princess is.
Use any technology you want. Use any other resources at your hand.
Use all your spying skills and intellect.
You need to find out where the princess is.| Report Duplicate | Flag | PURGE
Brain Teasers Problem Solving - 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
AnswersDesign the backend system for a website like HackerRank
- R@M3$H.N March 16, 2015 in United States| Report Duplicate | Flag | PURGE
Snapdeal Object Oriented Design Problem Solving System Design - 1of 1 vote
AnswersImplement a MessageBroker which accept messages from Publisher and deliver to Subscriber.
- vinodjayachandran March 15, 2015 in India
To begin with start with single Publisher and Subscriber. But design it in such a way to scale up to many publisher and subscriber associated with a Single Broker.
Take Performance and parallel processing into consideration.| Report Duplicate | Flag | PURGE
Flipkart SDE-2 Problem Solving technical - 3of 3 votes
AnswersFind longest substring with "m" unique characters in a given string.
- tazo March 12, 2015 in United States
input: aabacbeabbed
output:
4 (aaba) for 2 unique characters
6 (aabacb) for 3 unique characters| Report Duplicate | Flag | PURGE
Google Dynamic Programming Problem Solving - 1of 1 vote
AnswersCreate a maze.
- marinalepi March 06, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Problem Solving - -1of 1 vote
AnswerYou're the guard of a prison, you want to keep an eye on the most dangerous prisoner. Each prisoner has a danger rank of his own and a group of friends (who also have danger ranks). You'll need to go through the prison and find out the prisoner who has the highest danger rank (his own + all his friends)
- Sai February 08, 2015 in United States| Report Duplicate | Flag | PURGE
Algorithm Problem Solving - -1of 1 vote
AnswersYou're the guard of a prison, you want to keep an eye on the most dangerous prisoner. Each prisoner has a danger rank of his own and a group of friends (who also have danger ranks). You'll need to go through the prison and find out the prisoner who has the highest danger rank (his own + all his friends)
- Sai February 08, 2015 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Algorithm Problem Solving - 0of 0 votes
AnswersYou're the guard of a prison, you want to keep an eye on the most dangerous prisoner. Each prisoner has a danger rank of his own and a group of friends (prisoners, who also have danger ranks). The guard has a list of prisoners with their corresponding danger ranks and he also has a list of the friends of each of the prisoners in the prison.
- Sai February 03, 2015 in United States
The danger rank is computed as follows: Prisoner 1 has a danger value of 5, his friends are Prisoner 2 and Prisoner 5, who have danger values of 3 and 4 respectively. So the danger value of Prisoner 1 is 5+3+4 = 12.
There could be any number of prisoners. Whichever prisoner has the highest value is the most dangerous(computed using the above method).
Friendship can be assumed to be symmetric.
Come up with an efficient algorithm to find the most dangerous prisoner?
The solution I came up with runs in quadratic time.
A hash table which has the Prisoner as Key and list of his friends as value
Compute the sum of danger rank of all friends one key at a Time. (n * N)
Maintain a max count and update it as necessary.
I believe there is a solution for this problem having better time complexity than O(N^2).| Report Duplicate | Flag | PURGE
unknown Algorithm Problem Solving Puzzle - 1of 3 votes
Answersdesign and implement a calculater that can calculate expressions like:
- srcnaks February 02, 2015 in -
+ 2 4
* 8 ( + 7 12)
( + 7 ( * 8 12 ) ( * 2 (+ 9 4) 7 ) 3 )
(PS:all items are space delimetered.)
Example answers
+ 2 4 => 2 + 4 = 6
* 8 ( + 7 12) => 8 * ( 7 + 12 ) = 152
( + 7 ( * 8 12 ) ( * 2 (+ 9 4) 7 ) 3 ) => 7+8*12+2*(9+4)*7+3 = 148| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Data Structures Problem Solving Stacks String Manipulation Trees and Graphs - 1of 1 vote
AnswersDesign a TinyURL like Service.
- R@M3$H.N January 16, 2015 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm Data Structures Problem Solving System Design - 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 - 1of 1 vote
AnswersColorful Number:
- nafisah.islam October 26, 2014 in United States
A number can be broken into different sub-sequence parts. Suppose, a number 3245 can be broken into parts like 3 2 4 5 32 24 45 324 245. And this number is a colorful number, since product of every digit of a sub-sequence are different. That is, 3 2 4 5 (3*2)=6 (2*4)=8 (4*5)=20 (3*2*4)= 24 (2*4*5)= 40
But 326 is not a colorful number as it generates 3 2 6 (3*2)=6 (2*6)=12.
You have to write a function that tells if the given number is a colorful number or not.| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Problem Solving - 0of 0 votes
AnswersA string "aBIY" is said to be a well-ordered word as each of the letters are in sequential manner regardless of case. So, "AbLe" is not a well-ordered word.
- nafisah.islam October 26, 2014 in United States
You are a anti-hacker. you have a number of character sequences. Your task is to generate all possible well-ordered word that can be generated by those numbers of given character sequences.| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Problem Solving - 0of 0 votes
AnswersEdge Detection:
- nafisah.islam October 26, 2014 in United States
Two-dimensional array representation of an image can also be represented by a one-dimensional array of W*H size, where W represent row and H represent column size and each cell represent pixel value of that image. you are also given a threshold X. For edge detection, you have to compute difference of a pixel value with each of it's adjacent pixel and find maximum of all differences. And finally compare if that maximum difference is greater than threshold X. if so, then that pixel is a edge pixel and have to display it.| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Problem Solving - 9of 9 votes
AnswersGiven a string (1-d array) , find if there is any sub-sequence that repeats itself.
- for.anonymous.usa October 22, 2014 in United States
Here, sub-sequence can be a non-contiguous pattern, with the same relative order.
Eg:
1. abab <------yes, ab is repeated
2. abba <---- No, a and b follow different order
3. acbdaghfb <-------- yes there is a followed by b at two places
4. abcdacb <----- yes a followed by b twice
The above should be applicable to ANY TWO (or every two) characters in the string and optimum over time.
In the sense, it should be checked for every pair of characters in the string.| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Algorithm Brain Teasers C C++ Coding Data Structures Dynamic Programming Problem Solving String Manipulation - 0of 0 votes
AnswersSolve T(n) = 2T(n-2) + 1.
- bjkountz1989 October 14, 2014 in United States| Report Duplicate | Flag | PURGE
Problem Solving - 0of 0 votes
AnswerSolve T(n) = 2T(n/2) + 2n log n.
- bjkountz1989 October 14, 2014 in United States| Report Duplicate | Flag | PURGE
Problem Solving - 0of 0 votes
AnswerSolve T(n) = 2T(n/2) + n.
- bjkountz1989 October 14, 2014 in United States| Report Duplicate | Flag | PURGE
Problem Solving - 0of 0 votes
AnswersStore a Tree of URI and give a java implementation for it to return handler for the URI , eg : url mapping like in spring-config.xml
- geekrocker August 18, 2014 in India| Report Duplicate | Flag | PURGE
Sonoa Systems SDE-2 Problem Solving - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - 0of 2 votes
AnswersHow to design a multi key hash map ( key count can be dynamic. if there are two keys , initiallly which can be used to find the value , keys can be increased to three as well ex: consider school structure. Intially , consider , student id is key , later , should be searchable even with key name , later with grade.
- gopi.komanduri July 05, 2014 in India| Report Duplicate | Flag | PURGE
Analyst Algorithm Arrays C# C++ Coding Data Structures Dynamic Programming Experience Hash Table Large Scale Computing Linked Lists Problem Solving Sorting Trees and Graphs - 1of 3 votes
AnswersDesign a telephone directory for large ppl (he gave example like design for India). fields will be , first name , last name , number . this should be searchable with first name , last name , number as welll.
- gopi.komanduri July 04, 2014 in India
later added more complexity like do the same for organisation where even it contains designations. so this should be searchable with designations.| Report Duplicate | Flag | PURGE
Analyst Algorithm Arrays C C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming Hash Table Ideas Large Scale Computing Linked Lists Object Oriented Design Problem Solving Trees and Graphs - -1of 1 vote
AnswersLets say you have a number n and there is an array that has size = n+1.There is one element repeated in the array. Can you find that number?
- learner123 June 05, 2014 in United States
Input spec: n = 5
int arr[6] = {3, 1, 4, 4, 5, 2};
Output: 4| Report Duplicate | Flag | PURGE
Problem Solving - -1of 1 vote
AnswersLets say you have a number n and there is an array whose size is n-1. Array contains numbers in between 1 to n and all unique numbers.
- learner123 June 05, 2014 in United States
But one number is missing from the array as its size is n-1. Can you find that missing number in the array?
Input Spec: n = 5
int arr[4] = {3, 1, 4, 5};
Output: 2| Report Duplicate | Flag | PURGE
Problem Solving - 0of 0 votes
AnswersLets say you have been given a number n. You need to find out all prime numbers starting from 1..to..n ?
- learner123 June 05, 2014 in United States| Report Duplicate | Flag | PURGE
Problem Solving - 0of 0 votes
AnswersSuppose an Archeologist is visiting Africa, who don't know the native language. There are two tribe, one of those always speaks the "Truth" and another one always speaks "Lie". Suppose you are in front of three such people, of course you don't know them as truth/lie speaking tribe. You asked a question, and the 1st one replies in his native language, which you don't know, then 2nd tells that the 1st person is lying(in english) and the third person tells that 2nd person is lying(in english).
- rms792 June 02, 2014 in India
Which tribe does the 3rd person belongs?| Report Duplicate | Flag | PURGE
Barclays Capital Analyst Problem Solving - 0of 2 votes
AnswersSay you were assigned the task to optimize a website, what would you do first?
- cha March 11, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Problem Solving