Problem 65. Word Counting and Indexing
- word_table = {'four','one','three','two','zero'}
- str_index_list = {[2 4 3],[4 2 1 5]}.
Solution Stats
Problem Comments
-
14 Comments
Something is broken on the third test case. I think the blank line between the 2nd and 3rd line of text is what's messing it up.
I submitted a solution that works for the first two cases and outputs perfect result (including the index output) for the last case on my desktop.
Somebody at the Cody team should check their test cases.
There is a workaround for the broken 3rd test case:
Because of the empty line, the size of sl is 2x2 instead of 1x4. So to bring sl into proper shape, just do str_list = str_list(:)' at the beginning of your code. This will leave the input for the first two test cases unchanged.
Thank you Jan for the workaround for the third test case.
Test suite doesn't check whether str_index_list is correct or not. It's incomplete.
There seems to be no check on the word indexing part of the problem. I passed the test suite without indexing at all.
If non-vector input lists are valid inputs (test case 3), this should be stated explicitly in the problem description
I know people are complaining about indexes, but the problem did not state how indexes should be created. And if there is no requirement, anything can be true.
tough for me to create the right index.
Problem has been broken for YEARS!!!! Needs to be fixed or removed!!!! word index lists are never even checked. Third test case has a bug in input.
The test suite has been modified to check the indexing cell array as well. Further modifications will be done shortly.
Last test is interesting! Nice brainscratcher
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.
https://blog.csdn.net/qq_44846756/article/details/116567963
have the answer
enjoyed this problem!
Solution Comments
Show commentsProblem Recent Solvers1743
Suggested Problems
-
Read a column of numbers and interpolate missing data
2283 Solvers
-
10024 Solvers
-
Back to basics 21 - Matrix replicating
1535 Solvers
-
Find the max element of the array
1527 Solvers
-
Double all elements in the array
1519 Solvers
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!