Problem 65. Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a master word table of all the words and an indexed version of each string.
The master list should have no repeated entries and should be sorted in alphabetical order. The index list must be an array cell of index of each cell member corresponding to the same value in the master list.
For Example
If str_list = {'one two three','two one four zero'}
then
- word_table = {'four','one','three','two','zero'}
- str_index_list = {[2 4 3],[4 2 1 5]}.
Notice that no words are repeated in word_table, and each string in the string_list can be regenerated by referencing into the word_table using the string_index_list.
Solution Stats
Problem Comments
-
14 Comments
Show
11 older comments
Marco Riani
on 31 Dec 2021
I must say I do not agree with the bad comments which have been given to this test. I think it is explained properly and the tests seem to me appropriate.
arsenic 陈
on 8 Mar 2022
https://blog.csdn.net/qq_44846756/article/details/116567963
have the answer
Dianne Valera
on 26 Apr 2022
enjoyed this problem!
Solution Comments
Show commentsGroup

Matrix Manipulation I
- 16 Problems
- 98 Finishers
- Remove the air bubbles
- Remove NaN ?
- N-Dimensional Array Slice
- Back to basics 21 - Matrix replicating
- Back to basics 23 - Triangular matrix
- Make an awesome ramp for a tiny motorcycle stuntman
- Flip the main diagonal of a matrix
- surrounded matrix
- Some Assembly Required
- Set some matrix elements to zero
- Matrix with different incremental runs
- Removing rows from a matrix is easy - but what about inserting rows?
- Rotate input square matrix 90 degrees CCW without rot90
- Permute diagonal and antidiagonal
- Operate on matrices of unequal, yet similar, size
- Reverse the elements of an array
Problem Recent Solvers1829
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!