FIA神卡的神话在继续?# Money - 海外理财
n*n
1 楼
Given a list of words with a same size and a big string that
contains one of the permutation of all the words combined(say p),
find the start index of the string p in the big string.
现在能想到的解法就是:
- find the positions of all the words in the big string
- if you mod with the size of word(same for all words)
should give the same value for all the word positions in the big string and
the lowest position is the startindex.
不知道大家有什么更好的办法没有?这题要用trie吗?
contains one of the permutation of all the words combined(say p),
find the start index of the string p in the big string.
现在能想到的解法就是:
- find the positions of all the words in the big string
- if you mod with the size of word(same for all words)
should give the same value for all the word positions in the big string and
the lowest position is the startindex.
不知道大家有什么更好的办法没有?这题要用trie吗?