hsantosh71
BAN USER- 0of 0 votes
AnswersDesign an API that will support constant time add, remove, search and random find operations. Random find will get a random number and return that element. Note: Only hash map will not be sufficient since it cannot support random read.
- hsantosh71 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Data Structures - 2of 2 votes
AnswersGiven a family tree for a few generations for the entire population and two people write a routine that will find out if they are blood related. Siblings are blood related since they have the same parents. Cousins are blood related since one of their parents have the same parents etc. Design the data structure first and then write the routine.
- hsantosh71 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Trees and Graphs - 0of 0 votes
AnswersGiven multiple stream of input numbers each of which may not fit in memory (we can assume each source to be individually sorted) give an API design to merge and store a fully sorted array. Design must be object oriented which can handle any number of input source types. Obviously output also cannot fit in memory.
- hsantosh71 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Object Oriented Design - 2of 4 votes
AnswersGiven a sequence of numbers such that A[0] >= A[1] and A[N-1] >= A[N-2] find at-least one triplet such that A[n-1] >= A[n] <= A[n+1]. Better than linear time is expected.
- hsantosh71 in United States
Example: 9 8 5 4 3 2 6 7
Answer: 3 2 6| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
AnswersFind the majority number in a given sequence of numbers (a number that occurs more than N/2 times where N is the count of numbers in the sequence). Don't maintain a map of all occurring numbers along with a count. No number may be a majority.
- hsantosh71 in United States
Example: 1 1 2 3 4 1 6 1 7 1 1
Majority number is 1 since it occurs 6 times (> 11/2)| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - -7of 9 votes
AnswersGiven a file with a set of space separated numbers in a file write a program to remove duplicate rows. Two rows are duplicate if they contain the same numbers regardless of the order in which they occur. Constant time algorithm expected. LogN time is not good enough.
- hsantosh71 in United States
Given file:
1 2 3 4 5
3 6 7 8 9
2 4 7
1 5 3 2 4
Answer expected:
1 2 3 4 5
3 6 7 8 9
2 4 7| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm