Ad
  • Custom User Avatar

    Question for the Java implementation the Second performance test seems to expect the wrong result, I printed and copied the ~60000 character strings into my IDE.
    I performed the Unit Test with the expected result of codewars, my method removed 5999X characters and only the spare characters of the longer String were left, this indicates that the Strings seem to match with each other so scrambles should return true.
    After adding a random character which is not part of the leftover characters, my scarmble returned the expected false after 58XXX chars were removed.
    Can someone verify this?

  • Custom User Avatar

    I Tested my Code with these Tests:
    @Test(expected=NodeException.class)
    public void NodeTest(){
    assertEquals(BigInteger.valueOf(0), Cable.calculateLength("a"));
    }
    @Test(expected=BracketException.class)
    public void BracketTest() {
    assertEquals(BigInteger.valueOf(0), Cable.calculateLength("(()"));
    }
    @Test(expected=BracketException.class)
    public void BracketTest2() {
    assertEquals(BigInteger.valueOf(0), Cable.calculateLength("(())))"));
    }
    and obviously the Given Tests, when I try to compile the solution I get that stacktrace:
    olutionTest.java:89: error: cannot find symbol
    private BigInteger calculateLengthSolution(String cable) throws BracketException, NodeException{
    ^
    symbol: class NodeException
    location: class SolutionTest
    SolutionTest.java:25: error: cannot find symbol
    @Test(expected=BracketException.class)
    It seems like the compiler cannot find my defined exceptions even though he finds them in my IDE

  • Custom User Avatar

    I am Sorry to bother you but Error Messages are still the same for me. Is the fix pushed allready?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    1. not it's not your solution, that's a bug in the test suite (see issue I opened above)
    2. no, if you throw an exception, there is no returned value. Just throw the exception.
  • Custom User Avatar

    Java: the internal solution does not throw NodeException while it is declared as a checked exception in the signature (see message below)

  • Custom User Avatar

    I am kinda confused by this output: SolutionTest.java:89: error: cannot find symbol
    private BigInteger calculateLengthSolution(String cable) throws BracketException, NodeException{

    Isn't our method called calculateLength ?
    Also what should be the output when the excpetions are thrown? I assumed you set the result to 0;
    SampleTest run smooth in 10ms