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.
You shouldn't use parentheses without a purpose
This comment is hidden because it contains spoiler information about the solution
Sure. I have changed the description and examples to reflect your suggestions. Thanks for your contribution!
Would you be interested in some edited language in the descriptions so other's don't make the same mistake as I did? For example: given a
pattern
and a stringstr
, find ifstr
follows the same sequence aspattern
.The examples, as written, can be taken two different ways also, so maybe something like:
word_pattern('abab', 'truck car truck car') == true
word_pattern('aaaa', 'dog dog dog dog') == true
word_pattern('abab', 'apple banana banana apple') == false
word_pattern('aaaa', 'cat cat dog cat') == false
Hi ecocode
There is only one number test and that is in the
Initial Tests
section. For the random tests, all the strings are chars.hello and thanks for this kata, i am enjoying it BUT!! i keep failing one test. Is it possible for the pattern to contain at least one element that is a number greater than 9?
Thank you.
Haha I see it now. Thanks for your patience!
Ok I must be completely mistaken about how the kata should be working. I thought the string should include the letter in the pattern? Truck does not include the letter b. In the other examples this holds true and is what I was trying to achieve.
I need to know why you think your solution should pass. Why is your solution returning
false
? For patternabba
and strcar truck truck car
, you can see thata = car
andb = truck
. Soa(car)b(truck)b(truck)a(car)
. Your solution should returntrue
I was working through the ruby version. If you need more info than that let me know what you need.
I need more info than that man.
This is one of the test cases:
Test.assert_equals(word_pattern('abba', 'car truck truck car'), true)
I was wondering why I kept failing the tests.
It's still confusing. I used
and most test cases passed, integer or not, but the random input test cases failed. I can just change the code based on your comment above but still don't understand what's expected.