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.
Great answer, in your answer are the response of why this code should be replace by not reivent the wheel and use Integer.parse and avoid these lines that does not gather unknown inputs. it's just my opinion and your code is ok.
This comment is hidden because it contains spoiler information about the solution
and the check for length can be done before the loop
exactly, strange it got so many 'clever' votes.
So close ;)
Looks like a C program. There is a stack in Java, use it. Guess it doesn't handle "(x)".
This doesn't work - try {'n', 'w', 'n', 'w', 'n', 'w', 'n', 'w', 'n', 'w'} as input.
Yes, we can solve that by doubling array + liniear hashing for example. But I think it is okay for sake of possible solution.
This will fail when there are hash collisions.
This case fits description and will brake a lot of exisitng solutions.
Case of shuffling numbers is not covered. I think below test case will cover it.
@Test
public void test5() {
assertEquals("", 2, new BrokenSequence().findMissingNumber("5 3 4 1"));
}
Will crash on empty string