coredo
BAN USER- 1of 3 votes
AnswersOn a given array with N numbers, find subset of size M (exactly M elements) that equal to SUM.
- coredo in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm - 4of 4 votes
AnswersDesign a data structure that supports kind of full text search but in numbers.
- coredo in United States
We are given file with lot of 10-digits numbers, for example:
1234 567 890
4124 123 123
3123 123 322
On a given number X we should return all numbers that contain X.
For example, if the number 123 was given, we should return all numbers (from the list above) because 123 is in all of them.
If the number 41 was given we should return only the middle number - because the number 41 is only in it.| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Data Structures - 0of 0 votes
AnswersGiven an array of contacts with phone numbers/emails you should detect and union identical contacts.
- coredo in United States
For example, given the following contacts array:
[ [ "John", "john@gmail.com", "john@fb.com"],
[ "Dan", "dan@gmail.com", "+1234567"],
[ "john123", "+5412312", "john123@skype.com"],
[ "john1985", "+5412312", "john@fb.com"] ]
We can see that john1985, John and john123 are the same person by their contact information.
We should output
[[ 0, 2, 3], [1]] (0,2,3 are the same person and 1 is another one)| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm
The runtime of this algorithm is O(2^n) even if targetSize is very low, let's say 2.
- coredo August 03, 2015