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.
🏍🏍🏍
Thank you for such a clear explanation.
Smart! I didn't think that taking the modulus would work like that.
Why this kata could be positive as training and could / should be approved:
1️⃣ Skill Improvement: This kata offers an excellent opportunity to improve programming and logic skills. It challenges you to implement the logic of the goalkeeper's movement in a soccer game, which will help you strengthen your problem-solving abilities.
2️⃣ Practical Application: The challenge is based on a real situation in a soccer video game. Passing this kata will allow you to understand and apply the concepts of goalkeeper movement in a practical context.
3️⃣ Clear conditions: The statement provides clear and specific rules for the movement of the goalkeeper in relation to the position of the ball. This allows you to have a clear and defined goal when implementing the feature.
4️⃣ Linear scale: The kata is based on a linear scale where the position of the goalkeeper and the ball are represented by numbers. This provides a simple and understandable context to address the challenge.
5️⃣ Rust programming language: The kata is designed to be solved in the Rust programming language. Passing it will allow you to practice and improve your skills in this particular language, which is valuable in the field of programming.
Tests. It has tests. It is indeed a very useful point.
//
nice one
Same as my solution except I didn't bother with the extra variable ;-)
Andrew seems to be right
When do you find the repetition?
Testing for -3 10 9 -7 -3 9 10 -7 -8 -8 9 1 10 2 -3
It should work for random inputs too: [-3, 10, 9, -7, -8] should equal [-3, 9, 10, -7, -8]
But what's wrong with this output?
The first number that repeats is -3, then -10 then 9 and so on.
Please, use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
No, read the instructions again, about the first test:
$this->assertEquals(3, count(duplicates([1, 2, 4, 4, 3, 3, 1, 5, 3, '5'])));
The first number that repeats, parsing from the left is 4, then 3 and lastly 1, so the expected answer is
[4, 3, 1]
it has nothing to do with descending order.In PHP some tests expect a descending duplicates array:
Failed asserting that two arrays are equal.
Expected: Array (
0 => 4
1 => 3
2 => 1
)
Actual : Array (
0 => 1
1 => 4
2 => 3
)
And others expect to return the duplicates array with the ocurrences order:
Failed asserting that two arrays are equal.
Expected: Array (
0 => 4
1 => 2
2 => 6
)
Actual : Array (
0 => 6
1 => 4
2 => 2
)
A Java kata with which makes you think 🤔👍 https://www.codewars.com/kata/5e477a54406d360001bc10f6/java
Would you solve it?‽
Loading more items...