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.
They should not be thought of as Strings ( even if they are - what they really are is just an implementation detail ). Think of them as a three-valued Boolean. They are in a Class of their own.
If you are familiar with Option types, you could also think of them as an Option Boolean, but that introduces unnecessary complexity.
Yes, the author means that these are string
I mean strings in Array
Ah, I got it mixed up. Thank you!
The first argument is the string, the second one is the prefix:
I don't get the part where in the instruction it says "startsWith("nowai", "nowaisir"); // should return false" then in later lines it says "i.e. startsWith("hello", "HE") should return false, whereas startsWith("hello", "he") should return true." Which statemetn is correct? The second one? Thank you in advance
Thank you so, so much for both your tips!!! The first one is super useful and the second one perfectly answers my question. Once again, thank you so much
[1, 1, 2, 2, 3]
gives 1+2+3 when the expected answer is 3, since you should not include 1 (it appears more than once) or 2 (it appears more than once) at all.This comment is hidden because it contains spoiler information about the solution
Hi, I am a bit confused about the input. What is the class type of Like or Dislike? Are they strings? Are they boolean like True or False? Thank you in advance
thank you - by any chance, do you know why '\n' doesn't lead to automatic next line and instead prints out '\n' in codewars code editor? In my Pycharm when I did '\n' it automatically printed 3*3 #s without '\n' printed.
Because you're escaping the backslash like that and you should use a line-break instead:
'\n'
See the sample test:
I'm struggling with printing single backslash. In my pycharm app it works fine when I put "\" but for some reason it doesn't work in codewars. Can someone explain what is going on? Thank you
love your simpson
Thank you very much for your advice. They are very, very helpful. I will work on the easy questions first - once again thank you so much.
Your approach is too inefficient to pass this kata. The problem of the method you are using (in both codes you are providing; they are actually equivalent) is that for each item in the list, you need to make a complete loop over the list to get the value you are interested in. If the array has 10 elements, your code will have to make 10 * 10 operations. If the array has 1000 elements, then it will be 1000 * 1000, etc. It's easy to understand that this approach is extremely slow with large arrays. It's hard to give you a concrete answer without giving away the solution. Actually it is possible to solve this kata with only 2 * n operations (with n being the length of the array). Try to think how you could adapt your second code to do it. If you don't manage it, try to make some research with good keywords. In Python, there are some data structures available that almost do all the job for you.
Loading more items...