Problem 65. Word Counting and Indexing
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.
have the answer
enjoyed this problem!
Solution CommentsShow comments
Problem Recent Solvers1441
Return the first and last characters of a character array
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!