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.
Woah!!! I realize this is a few years old but good god this is impressive. I'm pretty new to this so most the solutions I find are... clunky. It's super rad to see something like this is possible! Someone called this Regex and you'd better believe I'll be spending some time learning how that works. Thanks for this!
Yes there is an issue with the test cases.
They should add a test case like the one you lay out here.
yep, but thats not a valid solution, it doesnt check sides or corners of ships size >= 2
i dont know if you can paste this, but it will return 'true' with fileds like this
[[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 0, 0, 0, 1, 0],
[1, 0, 1, 0, 1, 1, 1, 0, 1, 0],
[1, 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, 1, 1, 0, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0]]
check out what i did with lines 6 and 7
You could also use trimEnd
On the other hand, there doesn't seem to be any logical reason, given the stated requirements, why a single-letter vowel ought to return true and a string of only consonants ought to return false. It feels like the unit tests for these edge cases were added solely to bias the solver toward a particular solution--one which might not preserve the continuity between the problem and solution as well as one that behaved more logically.
So elegantly simple. Wow. So, when searching for something difficult to find, try searching instead for its opposite. Lesson learned. Thank you.
nice!
This is short, efficient, and readable at the same time! A really nice one. Tipping my hat. :)
This one has made my day. It's beautiful.
While
trimRight
is a handy method, it's not recommended to use (particularly in production environments) as it's non-standard (refer to: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimRight) and thereby it won't work in all major browsers.For the sake of this kata, however, it has practical use.
EDIT: spelling
Had no idea there are trimRight or trimLeft methods available, had to come up with a very awkward construction instead. You never fail to learn new things on Codewars )
REGEX NINJA!!!
Whoa, thank you. You'll be there :)
Dear Zoey, very clean and concise. I want to be at Zoey level one day. I've got more learning to do. :)
Such a neat use of the XOR operator!
Loading more items...