问一个FB的题# JobHunting - 待字闺中
o*0
1 楼
Design a data structure that supports kind of full text search but in
numbers.
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.
能想到的是转成string,再search.
numbers.
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.
能想到的是转成string,再search.