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.
Maybe you mistyped it like you did just now.
Think you're right @fenring76 – I can't speak to what I was thinking four months ago, but that does appear to be what paraliterary was saying.
In any case, the code outputs
False
for this input which is the expected result (because of the aforementioned L shaped vessel), so perhaps paraliterary was testing a different input to the one provided.Sorry @paraliterary for (presumably) misunderstanding what you said, I hope you got to the bottom of the situation.
Isn't @paraliterary's point that the field is invalid but your solution returns
True
indicating that it is valid?The solution is correct, your input is invalid - you've provided an (invalid) L shaped vessel in the top left.
Goode one just learn it =)
I tried to use intertools in former katas and it seems it's not integred in Codewars and there's no console to install it, heh.
omg wtf
This solution returns true when false is due for:
snattleField = [
[1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[1, 1, 0, 0, 1, 1, 1, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
Elegant but not correct!
Can I share a screengrab from my G Colaboratory to confirm this?
That is actually just- 6 lines???? HOWWWWW
WHAT, 6 LINES?!
"Everything you want, it's already there in a library somewhere"
And this is the exact representation of it.
It's no bad thing to import modules if they get the job done! There's a time and a place for code golf. That said - with the distance of several years' hindsight - I should probably have added a short comment.
Really nice! I saw someone else use a for-loop with an xor operator (i.e. "^") which is similar and doesn't need an import. I like this the best because it is O(n) and it is very clean. It's a bit more arcane than the simplest solution, but for large values of N this is definitely the right approach.
Good work :)
The code you have written is exceptionally elegant
I found it. Thanx
Loading more items...