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.
.
Modifying
board
content breaks the random tests.Sample tests contain a
x
, which is not a valid chess piece.This comment is hidden because it contains spoiler information about the solution
"Given a number n, return the
number of positive odd numbers
below n, EASY!"Teach me almighty one liner
"." could be lifted out of ternary if :)
The first sample test has an 'x' on the board. What does that represent?
Could've also used 1 in the place of 0 if im not mistaken...
genius!
needed to use use groups in the replacement
yeah for replacing matched groups we need parantheses
check this out for more info
https://stackoverflow.com/questions/37734164/regex-backreferences-in-java
last two replaceAll calls can be condensed into replaceAll("^-|-$","").
This comment is hidden because it contains spoiler information about the solution
Althought brackets arent necessary in this case they help to clarify the idea that lead to the solution :)
Loading more items...