Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Might be showing off. Might be trying to be educational.
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
print
is your friend. ;)This " should pass random tests, where the input returns suggestions from dictionary (53 of 100 Assertions) " is problem for me. I don't understand what need to do. Can someone help me?
Approved. Thanks!
Ruby translation kumited (including some minor update to the description). Please check and approve
This comment is hidden because it contains spoiler information about the solution
@FArekkusu your method may still have at least one match from the dictionary. If I replace a random digit with another digit, I may still get a match from another word in the dictionary.
Example: I have
['ape','ate']
in the dictionary, and I choose '273' (from ape). I replace the center '7' with '8' according to your algorithm. Now,'ape'
wouldn't match with'283'
, but'ate'
(code'283'
) would match. So a single replacement may generate a match from another word in the dictionary, where the original point was to avoid any matches by replacing a single digit.@B4B depends on the implementation. I'd do it like this:
This will always result in wrong new sequence.
@FArekkusu that wouldn't work at each time to get invalid inputs. But that's the way I'd proceed yes (checking the ratio of valid/invalid inputs afterward)
You know, you could simply replace a digit in the correct sequence and you'd get an incorrect sequence (but that'd be too easy, right?) :D
you did it "the hard way", but that's ok! ;)
Added random test cases, where the given
seq
will not have a match in the dictionary.Yes, I get it now. You mean to add random test cases where no match for the given
seq
will be found in the given dictionary. I will add another set of cases where the givenseq
will not be found in the dictionary, and where the return value must be a string made up of first letters of letter groups for the given input. Give me a couple of minutes.Loading more items...