Software Developer Interview Questions
- 2of 2 votes
Answers"Smart substring"
- ersegun August 20, 2015 in Netherlands
Write a function that takes maximum 30 characters from a string but without cutting the words.
Full description:
"Featuring stylish rooms and moorings for recreation boats, Room Mate Aitana is a designer hotel built in 2013 on an island in the IJ River in Amsterdam."
First 30 characters:
"Featuring stylish rooms and mo"
Smarter approach (max 30 characters, no words are broken):
"Featuring stylish rooms and"| Report Duplicate | Flag | PURGE
Booking.com Software Developer String Manipulation - 0of 0 votes
AnswersFind the nth Fibonacci Prime, in the shortest code
- kesavan August 19, 2015 in India| Report Duplicate | Flag | PURGE
unknown Software Developer - -1of 1 vote
AnswersBillions of 2 digit number is coming from stream and you have a variable avg. which store only 2 digit number that means you cant store 2 number in any temp variable also.calculate avg on incoming stream
- pbox August 19, 2015 in India| Report Duplicate | Flag | PURGE
Flipkart Software Developer - 2of 4 votes
AnswersA string contains a-z, A-Z and spaces. Sort the string so that all lower cases are at the beginning, spaces in the middle and upper cases at the end. Original order among lower and upper cases needs to remain the same. For example: a cBd LkmY becomes ackm BLY. Is there a way in O(n) without extra space?
- chad August 13, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm Arrays - 5of 5 votes
AnswersI came across this problem online.
- xiaoc10 August 07, 2015 in United States
> Given an integer:N and an array int arr[], you have to add some
> elements to the array so that you can generate from 1 to N by using
> (add) the elements in the array.
Please keep in mind that you can only use each element in the array once when generating a certain x (1<=x<=N). Return the count of the least adding numbers.
For example:
N=6, arr = [1, 3]
1 is already in arr.
add 2 to the arr.
3 is already in arr
4 = 1 + 3
5 = 2 + 3
6 = 1 + 2 + 3
So we return 1 since we only need to add one element which is 2.
Can anyone give some hints?| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 4of 4 votes
AnswersCheck if two integers are equal without using any comparison operators.
- coolProgrammer August 03, 2015 in United States| Report Duplicate | Flag | PURGE
Google Software Developer Bit Manipulation - 2of 2 votes
AnswersFind how many numbers of length n are there such that each number is at least 4 smaller/greater than the number before and after it.
- coolProgrammer August 02, 2015 in United States
Eg: if n = 5, such numbers are 39518, 15951, etc.| Report Duplicate | Flag | PURGE
Google Software Developer Dynamic Programming - 1of 1 vote
AnswersThere are three closed doors. Behind two of them there are donkeys, behind the third one there is a Mercedes-Benz. (Your task is to get the Mercedes, not the donkey).
- leonid.ge July 31, 2015 in United States
You are asked to choose one of the doors. Once you have chosen, they open one of the remaining two doors with the donkey. Now there are two doors left: one you chose and the other one. To maximize your chance of getting the Mercedes, should you keep your choice or switch to the other door?| Report Duplicate | Flag | PURGE
xyz Software Developer Brain Teasers - 0of 0 votes
Answerswrite a program how many squares in chessboard ?
- ajju July 26, 2015 in India| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersImplement hashtable put function in C++ without using STL stuff.
- kustiki July 21, 2015 in United States| Report Duplicate | Flag | PURGE
Bloomberg LP Software Developer - 3of 3 votes
AnswersGiven a matrix containing 0 and 1. Consider 1 as 'Land' and 0 as 'Water'. Find out the number of 'Islands' in the matrix. That is, set of all adjacent 1 will make up for an island.
- prajakta mahamuni July 17, 2015 in India
For example:
[ 0 1 1 0 1 ]
[ 1 1 1 0 0 ]
[ 0 0 0 1 1 ]
[ 1 0 0 1 0 ]
This problem has 4 islands. ( consider set of 1s, vertically, horizontally and diagonally ).| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswersPlease provide Oracle SQL and PLSQL questions
- subhasinibhosal1004 July 17, 2015 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Developer SQL - 0of 0 votes
AnswersSuppose you have strings read in from a stream, e.g., '()(,)(())'. Detect if the parenthesis pair up correctly.
- Yev July 16, 2015 in United States
Part 1: How would you use threads to solve the problem?
Part 2: He then gave me an iterative solution and asked how the problem can be done distributively across multiple components.| Report Duplicate | Flag | PURGE
Here Software Developer Algorithm - 1of 1 vote
AnswersGiven a hashmap, HashMap<String,List<String>> with the following data:
- Yev July 16, 2015 in United States
A: B,C
B: X Y
X: Z
Y: Z
Expected output is an array of the dependencies. I initially started with Breadh-first search for simplicy, which had running O(|V|+'E') and space O(|V|). The interviewer said depth-first search is better; I don't see how DFS is better, because it requires recursion.
Part2: He then said my solution is functionally correct and then introduced a circular dependency and asked how to resolve it. I said using a visited hashset will detect a circular dep. He said it's not quite right and there a few approaches.| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 0 votes
AnswersGiven a string of english characters. Find the character that appears only once. I used arr[256] to store a count of each character. Then, iterate over the array to find the first non-dup, a[iter+'a']==1. The interviewer thought that storing a[iter]='x' (dup) and a[iter]=<index> was a better solution to avoid running a second pass over the string. In my mind, I disagreed using the array index, one can find the character that appears only once. The interviewer persisted, and told me to think about it.
- Yev July 16, 2015 in United States| Report Duplicate | Flag | PURGE
Here Software Developer Java - 0of 2 votes
AnswersWrite a function which takes a BST and then "flattens" it (converts in-place into new BST), so all the nodes have only right child and no left.
Example:10 / \ 5 15
Output:
- Eugene July 16, 2015 in United States5 \ 10 \ 15
| Report Duplicate | Flag | PURGE
Microsoft Software Developer - 0of 0 votes
AnswersYou are given an array representing integer. Write a function which increments this integer.
- Eugene July 16, 2015 in United States
Example: input [1,2,3] (represents 123) -> output [1,2,4]| Report Duplicate | Flag | PURGE
Google Software Developer - 2of 2 votes
AnswersA single-elimination tournament with 64 teams. Before the tournament, fans construct fantasy brackets for their tournament predications. Design a data structure for storing fan brackets and algorithm to score their brackets against a winning bracket. Assume we will then need to quickly score a player’s predictions (1 point per successful round prediction) and your solution should be optimal enough to handle millions of fan brackets with minimal data.
- DVD July 15, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures - 2of 2 votes
AnswersCount triangles in an undirected graph where a triangle is a unique set of three vertices connected to one another.
- tested.candidate July 14, 2015 in Switzerland| Report Duplicate | Flag | PURGE
Google Software Developer Algorithm - 0of 0 votes
AnswersImplement a bowling game. First person took 40 mins to make sure I understood the scoring of bowling. Got stuck on coding an open-frame/strike/open-frame and time ran out with the second interviewer.
- Yev July 14, 2015 in United States
class Frame
def initialize
@rolls=[]
end
def roll(pins_down)
end
def score
end
end
class Game
attr_reader :frames
def initialize
@frames=[]
end
def score
end
end| Report Duplicate | Flag | PURGE
Centro Software Developer Ruby - 0of 0 votes
AnswersWrite code in the language of your choice to determine how many numbers between 1 and 100,000 contain an even number of odd digits
- James July 11, 2015 in United States
What I understand that number of digit in a number should be odd
is..
2 4 6 8 are even number which having only 1 digit and 1 is odd number
10 12 14 18 ……are even number but number of digit in these number are 2. 2 is not odd number hence we gonna discard all these number
102 104 106 …. Are even number and number of digit in these number is 3 that is odd number hence we will count these number
1000 1002 1004….are even number and number of digit in these number is 4 that is even number hence we will not count these number…
Please let me know if you think differently.| Report Duplicate | Flag | PURGE
Microsoft Software Developer - 0of 0 votes
AnswersWrite an itoa
- JSDUDE July 09, 2015 in United States| Report Duplicate | Flag | PURGE
Booking.com Software Developer Algorithm String Manipulation - 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 - 0of 0 votes
AnswersGiven a string such as "123", convert it to an integer. Basically, write Integer.parseInt(string).
- moriarty.rj June 30, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswersGiven a CSV of names and ages, perhaps:
- moriarty.rj June 30, 2015 in United States
Alice, 30
Bob, 17
Clyde, 49
Sort the names by age.| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 2 votes
AnswersSerialize & Deserialize a binary tree
- JSDUDE June 24, 2015 in United States| Report Duplicate | Flag | PURGE
Uber Software Developer Trees and Graphs - 0of 0 votes
AnswersImplemented a bounded queue:
- JSDUDE June 23, 2015 in United States for Customer experience
Read:
If queue is empty, wait till it can return a value with time out
If another thread is reading from the queue then wait till that thread is done
Remove the first element from the queue and return it
Do not block if a thread is writing into the queue
Write:
If queue is full, wait till one value is read with time out
If another thread is writing to the queue, wait till that thread is done
Write the element at the end of the queue
Do not block if a thread is reading from the queue| Report Duplicate | Flag | PURGE
Walmart Labs Software Developer Data Structures Threads - 1of 1 vote
AnswersGiven a start string, end string and a set of strings, find if there exists a path between the start string and end string via the set of strings.
- JSDUDE June 23, 2015 in United States for Customer experience
A path exists if we can get from start string to end string by changing (no addition/removal) only one character at a time. The restriction is that the new string generated after changing one character has to be in the set.
start: "cog"
end: "bad"
set: ["bag", "cag", "cat", "fag", "con", "rat", "sat", "fog"]
one of the paths: "cog" -> "fog" -> "fag" -> "bag" -> "bad"| Report Duplicate | Flag | PURGE
Walmart Labs Software Developer Algorithm String Manipulation - 0of 0 votes
AnswersGiven an array of integers (+ve & -ve) find two equal sized contiguous non-overlapping sub-arrays with maximum dot-product
- JSDUDE June 23, 2015 in United States for Customer experience| Report Duplicate | Flag | PURGE
Walmart Labs Software Developer Algorithm Arrays - 0of 0 votes
AnswersWrite an OO class system for individual-contributors, managers, directors.
- JSDUDE June 23, 2015 in United States for Customer experience| Report Duplicate | Flag | PURGE
Walmart Labs Software Developer Object Oriented Design