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.
Barely readable but very clever
Good point. It doesn't. It shouldn't pass the tests, but the tests are too lenient.
This comment is hidden because it contains spoiler information about the solution
Where does this one validate the 3x3 squares?
@Olegkovtun - Wow, that one is great. Very clever, efficient, readable, and understandable. I am super impressed with yours.
The chosen answer above is clever in that it uses very few lines but it fails in the other 3 categories so I am not sure why some people voted it as a best practice.
Test cases your solution fails correctly expect
false
. Both test casees you presented have invalid 3x3 sub-grids.This comment is hidden because it contains spoiler information about the solution
Please see this paragraph and make sure you are readign logs correctly: https://docs.codewars.com/training/troubleshooting#print-input
If you are 100% sure your solution is correct, post your code so we could diagnose your problem.
I guess the test is done randomly because after testing it again, I fail on a different array each time that incorrectly expects false -
4 5 9 3 7 2 8 6 1
2 3 7 1 5 9 6 4 8
9 1 5 8 3 7 4 2 6
3 4 8 2 6 1 7 5 9
1 2 6 9 4 8 5 3 7
5 6 1 4 8 3 9 7 2
8 9 4 7 2 6 3 1 5
7 8 3 6 1 5 2 9 4
6 7 2 5 9 4 1 8 3
and
3 8 7 1 4 9 2 5 6
6 2 1 4 7 3 5 8 9
9 5 4 7 1 6 8 2 3
5 1 9 3 6 2 4 7 8
2 7 6 9 3 8 1 4 5
4 9 8 2 5 1 3 6 7
7 3 2 5 8 4 6 9 1
1 6 5 8 2 7 9 3 4
8 4 3 6 9 5 7 1 2
I submitted my solution for Java and the moreRandomTests failed. I manually checked and my code is correct, it is the expected solution that is wrong. This one expects false -
4 5 6 8 9 7 1 2 3
7 8 9 2 3 1 4 5 6
1 2 3 5 6 4 7 8 9
8 9 1 3 4 2 5 6 7
2 3 4 6 7 5 8 9 1
5 6 7 9 1 8 2 3 4
6 7 8 1 2 9 3 4 5
9 1 2 4 5 3 6 7 8
3 4 5 7 8 6 9 1 2
“Way too much code.” Is this a joke?
Delete the first function and the code won't compile. So much for “completely pointless.”
There is way too much code for this simple problem. The first function is completely pointless. I can understand the train of thought of creating the final function for readability, but the actual implementation falls short because of poor naming. Boolean functions should be in question form, aka isEven(int number)
Chars have a value. E.g. '3' is 51 and '0' is 48. Subtracting is a way to convert chars to int.
This comment is hidden because it contains spoiler information about the solution
it's always all at once.
Loading more items...