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.
Please add some comment to your solution. It is giberrish IMO
I'm sorry. How careless of me.
Wrong solution.How about board with -1 and 10 ? just like this(all 1 is replaced by -1 and all 9 is replaced by 10)
[
[5, 3, 4, 6, 7, 8, 10, -1, 2],
[6, 7, 2, -1, 10, 5, 3, 4, 8],
[-1, 10, 8, 3, 4, 2, 5, 6, 7],
[8, 5, 10, 7, 6, -1, 4, 2, 3],
[4, 2, 6, 8, 5, 3, 7, 10, -1],
[7, -1, 3, 10, 2, 4, 8, 5, 6],
[10, 6, -1, 5, 3, 7, 2, 8, 4],
[2, 8, 7, 4, -1, 10, 6, 3, 5],
[3, 4, 5, 2, 8, 6, -1, 7, 10],
]
Прекрасное решение через Set! Однако, с точки зрения алгоритма, код можно улучшить.
Цикл for следовало бы включить в функцию validSet, и затем проверять валидность поэтапно, а не единожды в конце...
Ведь если, к примеру, строки (rowSet) не валидны, то составлять столбцы (columnSet) и квадраты (boxSet, boxCorner) дальше уже не имеет смысла.
Да, при этом код стал бы внешне чуть менее лаконичным, но думаю это было бы логичнее и производительнее.
Although it checks for uniqueness, the numbers could still be greater than 9
This is the kind of functional programming i am striving to learn how to write.
Super clever
So many people doing it like this. Pretty crazy.
boxCorner is so impressive how did u come with this idea i mean how good are u at math ? i want to become better i u can give me some tips
Very elegant use of the Set here. Congratulations.
Can somebody explain this answer please?