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

49.84% Correct | 50.16% Incorrect
Last Solution submitted on Nov 22, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers1742

Suggested Problems

More from this Author96

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!