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.
Humm? Is not your own solution read through the string a lot mor of times? doing a cicle for you are reading the string mor than once for each character.
This comment is hidden because it contains spoiler information about the solution
The goal was not to rewrite the code, just make it work. But of course, this one is much clearer than the previous one.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This made my day aha
This comment is hidden because it contains spoiler information about the solution
Shouldn't be any issue with modifying the given parameter as we are told that we "can assume that all inputs are valid integers".
From MDN:
"Parameters are essentially passed to functions by value — so if the code within the body of a function assigns a completely new value to a parameter that was passed to the function, the change is not reflected globally or in the code which called that function.
When you pass an object as a parameter, if the function changes the object's properties, that change is visible outside the function."
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The main method play() is very readable, well done !
He did not do the same thing. The .sort() method has a time complexity of O(n log(n)). This algo can be solved with one simple for loop as seblm described with a time complexity of O(n), which will be far more performant as your array grows in size.
whats the difference than? you did the same thing.
The description should specify that we have to find distance btw a letter and its nearest vowel, IN THE GIVEN STING. And not in the ALPHABET. Lost so much time trying to understand these examples.
Your problem comes from the concept of proximity. The description says that we sould return the pair with the lowest last element's index. It means that in [10, 5, 2, 3, 7, 5] the answer is [3,7]. In [10, 5, 2, 3, 5, 7] the answer is [5,5] because the last 5 has an index lower than 7.
Loading more items...