I haven’t tried it before, any advice is welcome I feel that the questions in Goose Factory are more exam-oriented, focusing more on basics and thinking skills
Programming questions: 1 Multiplication of large numbers, the original question of leetcode, go here to see how the top-voted answer is written 2 Count the number of repeated words. Two ideas: 1) Use a hash table to count the number of words that appear. C++11 has stl and the template unordered_map is available. The time complexity is O(n), n is the number of words. In fact, if you consider the number of words for each When calculating the hash value of a word, each word must be traversed. If the average length of the word is m, the time complexity of creating the table is O(m*n). The search time complexity is O(1). 2) Open a trie tree, traverse all words, and insert them into the tree. The time complexity of tree building is still O(m*n). Considering that there are conflict detection and secondary detection using hash tables, trie tree building should be Slightly faster. But the search is slightly slower, the time complexity is O(len), len is the length of the word being searched
Thinking of the second programming question (PHP version):
I haven’t tried it before, any advice is welcome
I feel that the questions in Goose Factory are more exam-oriented, focusing more on basics and thinking skills
I just learned that most companies don’t take Android and IOS tests separately. .
The Goose Factory is like this every year, so be bearish.
Programming questions:
1 Multiplication of large numbers, the original question of leetcode, go here to see how the top-voted answer is written
2 Count the number of repeated words.
Two ideas: 1) Use a hash table to count the number of words that appear. C++11 has stl and the template unordered_map is available. The time complexity is O(n), n is the number of words. In fact, if you consider the number of words for each When calculating the hash value of a word, each word must be traversed. If the average length of the word is m, the time complexity of creating the table is O(m*n). The search time complexity is O(1).
2) Open a trie tree, traverse all words, and insert them into the tree. The time complexity of tree building is still O(m*n). Considering that there are conflict detection and secondary detection using hash tables, trie tree building should be Slightly faster. But the search is slightly slower, the time complexity is O(len), len is the length of the word being searched