Problem 51675. Add 100
With this problem, I have added 100 to Cody. In a way, this problem asks you to add 100 as well.
Write a function to add C, the Roman numeral for 100, to one word in a list to make another word in the list. For example, you can add C to “hair” to make “chair” or to “lie” to make “lice”, assuming that all of these words are in the list. Add only one C but consider target words with multiple C’s—e.g., you can add a C to “scare” to make “scarce”. The function should return a cell array y1 with a list of original words sorted alphabetically and a corresponding cell array y2 with a list of words with the letter added.
(And if you are going to go through the trouble of writing the code for C, you might as well make it work for any letter used in English.)
Although 100 is an arbitrary milestone, it’s as good a time as any to express gratitude to MathWorks and the Cody community. Thanks to all of you for solving my problems, challenging us with your own problems, and helping me improve my own programming and problem solving.
Solution Stats
Problem Comments
-
3 Comments
William
on 4 May 2021
Chris -- Interesting problem. But test #6 somehow got truncated and doesn't work.
ChrisR
on 4 May 2021
Thanks William. My reference code worked last night. I think Cody truncated Test 6 and the seven after it because the cell array WORDS was too long. I removed several tests and asked Cody to rescore.
Dyuman Joshi
on 31 Aug 2022
The test suite can be made (a bit) more interesting by adding words list in non-sorted order
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
6830 Solvers
-
47 Solvers
-
425 Solvers
-
203 Solvers
-
5343 Solvers
More from this Author279
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!