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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
There is also a
clamp
method in Ruby: https://ruby-doc.org/core-2.4.0/Comparable.html#method-i-clampThis comment is hidden because it contains spoiler information about the solution
They are only needed whenever you aren't just using a simple variable. An example is "hello, ${person.name}" or "hello, ${name.replace("a", "b")}".
When is it neccessaryly tu use them? My attempt worked without them.
Thanks for reply
sure you're right👌
just in learning cycle😉
Curly brackets in a string template are redundant for that particular case.
This comment is hidden because it contains spoiler information about the solution
I am too lazy to modify sample cases for all translations. The most of them weren't even created by me. And probably even if I will try to modify it, there is so many solutions already, so I would probably hit a timeouot from CW.
And this kata is a part of collection. So .... it's too late already.
I guess you had this issue becasue you started from the second kata in the Alphabet war collection. All katas in this collection have similar rules.
BTW. Try other katas in this collection! And thanks for your suggestion ;)
Ah, ok, I completely missed that. Thank you for pointing it out!
IMO that line was easy to glance over, or misunderstand. I think I interpreted that they weren't even part of the kata at all.
I think I made that misunderstanding because of a combination of:
Do you think it would be a good idea to add a test cases with non-weighted letters to the sample test cases then? I think that would help people understand.
Unless part of the fun is reading closely, and only finding out about the non-weighted once you do the actual attempt!
Please try to read my description again.
"(...)The other letters don't have power and are only victims (...)"
For the Java kata, the given sample test cases work fine because they only use the given left vs right side set of characters.
The issue is: the random test cases generate random characters. I think this makes no sense since we don't know the weighted values of those characters. The given letters in the description are weighted in power, so we can't possibly know what to weight a random character. We also aren't told to just treat any other character as a default of one, or anything like that.
So, I think this kata is broken for Java. You can't possibly pass the random tests which are using random characters in the fight.
EDIT: Actually, after trying some stuff, I got it to work by not considering the values of random characters at all. Maybe that's something you should put in the description... I had to guess that other characters could be ignored, then try it out and see if it worked. I had no idea that's what I was supposed to do.
This solution that you've commented on correctly deals with starting and ending spaces. Try it out by forking the solution and adding a test case with leading and trailing whitespace.
The opposite of
-2147483648
in aint
does not make any sense, so it's out of spec.Loading more items...