ARRY - 基本面良好的小biotech (转载)# Stock
s*n
1 楼
Suppose you are developing a search engineer. Given a sequence of
numbers as a query string. You need to design algorithm/data structure such
that it can return whether this number sequence belongs to some famous
number sequences. For example, if the query string is “0 1 1 2 3 5”, it
might belong to a Fibonacci sequence. Note that the given sequence may not
always start from the beginning of a known number sequence.
My idea:
For those "famous" number sequences, we may cut them into smaller sequences
(e.g. three numbers each). Then save these sequences into a database (NoSQL
key-value store). When a query comes in, cut it into smaller sequences with
the same length (such 3) and then look up in the database/key-value store.
Any suggestions? Thx!
numbers as a query string. You need to design algorithm/data structure such
that it can return whether this number sequence belongs to some famous
number sequences. For example, if the query string is “0 1 1 2 3 5”, it
might belong to a Fibonacci sequence. Note that the given sequence may not
always start from the beginning of a known number sequence.
My idea:
For those "famous" number sequences, we may cut them into smaller sequences
(e.g. three numbers each). Then save these sequences into a database (NoSQL
key-value store). When a query comes in, cut it into smaller sequences with
the same length (such 3) and then look up in the database/key-value store.
Any suggestions? Thx!