Ad
  • Default User Avatar

    I solved the main problem, but I can't understand the exception. Can you advise? Do we need to create new classes? I just do not fully know Java and I meet such names for the first time. you're gonna give me a heart attack. Don't scare me like that. Sorry for english ^_^ NIG

  • Custom User Avatar

    It's not a bug, it just performance test...
    You went over primitive range.

  • Custom User Avatar

    For a new pple, exceptions should be created outside SoulutionTest.class like a regular multiple classes in one file.

  • Custom User Avatar

    I'm a bit unsure of whether my code has an issue (entirely possible, I admit) or if there is and issue with the java tests. I am getting a good number of "unknown symbol" errors.
    Examples:

    ./src/test/java/SolutionTest.java:109: error: cannot find symbol
    	private BigInteger calculateLengthSolution(String cable) throws BracketException, NodeException{
    	                                                                ^
      symbol:   class BracketException
      location: class SolutionTest
    ./src/test/java/SolutionTest.java:109: error: cannot find symbol
    	private BigInteger calculateLengthSolution(String cable) throws BracketException, NodeException{
    	                                                                                  ^
      symbol:   class NodeException
      location: class SolutionTest
    

    It is entirely possible the issue is on my end, but it looks to me like the test solution class cannot see the BracketException and NodeException classes I created as static classes inside the Cable class, which makes sense. But I'm not sure how/if I can correct this on the test solution side.

  • Custom User Avatar

    @achtlos ..

    • Thanks for your Efforts Bro :blush:
    • Could you please , Check the issue raised Here Concerning the Java Translation .. Thanks in advance .. Regards .. Zizou
  • Default User Avatar

    Indeed, sorry for that. Correction made

  • Custom User Avatar

    Mark your comments as spoilers if you're writing anything that can giveaway the solution.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    thx donaldsebleung, I forgot to test this. I'll add it to my test case.

    And Indeed this solution doesn't work with the example below.

  • Default User Avatar

    Sorry but your string doesn't throw any exception. I got 38892296835628857864 if you want to create a simple test case. Good luck

  • Custom User Avatar

    Performance test throws BracketException (runs at 24ms). All the other tests are completed successfully. An example of String cable is:
    "()=()((=)((((=)(=(__-==)--=)(()-==-=()=(-=(---=(-=-=-=))=(=-(--(=()=)=((=((_-=)-()-()()(-(()-==)--(==(---=(-)=)((-))((-)-(=(=)(===)=()(---))=))))(===-()_)-=)-=(=)=(((-))-()()(()-()--)=((=)(--)--()))--))))-===__-=-))=()(=)-(-))=((()=)((-=)=()-===(-=-)(-))-((-(-=(=-)=-(--)=()(-)()-__===)(())=)())=)==-=)((()=))((=)---)=(-))-=-()()-=(-())()(()(=(=-(__(()====-==(=((--)=)-)-=()--=(=)--)==--=)()==-)--=)--)(=-(=-=(=)=)(==-)=(-)-(=-=-(-()-=)-=)==)-__-=()()-=-()()==(=(--=(()()(=(-=)=(__))()=)==)-())(()()(-))==-()-()--(-)(-)-()==(=((-=-(=-=(--()=(=-=(-((=)=)=---=-(==-=-)())--()=-==(=-(-)=(__)()-==-()()(===--=)=(=(==-)(=()--))))=()-(=(=-)((-()=-(===-=)(=-__-==(======--=-)==-===))))=)-==-))(-()----()--()((==)(==-))=-)()(-=(==)-)-((-)(==(--==(--((=)=---))()=-=(====--=()(=====(-)==((-==(-=-=--)=(=(()(=-(-_)--(---)=)---=(=)((===)(===-==-))(=()()(==(=-))-)(=()=(=(==)-()-)=(-=-()--(=-===)=(-__()=)=--(()(-(-=)=)(==)-)---_))=--=-=(-(-=)-=()===(())=()===()=))=))=-=)-==)-__=)-(------(=()=-=-=)--))=)(=-=(-=)))()--=)_()(-=-()=(=()(=((-()))())=-)(-(-=)-=)-(=-(===()--((=-(=)==()))(())-)()=-()-(-=(=)))--==(=(()-)()--=(((==-())_==((=)))--)=)=--())--=)-=(())(-=(=)()==)==(-)((-)=-(-)-=(-=-)--()--=(-)(-)-(-))-=-(=-=-)((-()))==()-=(=)(=-)-=-(=(-=-=()=--)=-_-()=(-()))-=(-((==(-=)())-==-=)-((=))()-)-((=)()=-)=(-())--=-=(=-=()--(=)=((-)-=)-(=-)-===--)()=()=-==(-)()()(-)==--(-)=((=(=-)-=()(-(--)(-=((()-(--==---)=__=((=)-==-((----=)((-(=)=__==(-=)==))(==()-)=))(-(-=))-(((=-==)))-(=-=)-(-=-)----(__)-))(=)-()()))()==-=-=)_=---=---)()()=-(=--)()=(--=(---(-)=)-(((=))(===-(-)-(-(=-))=----=()((-(=-==(-)((==--=())-))__(---)()---)=())=-)-)-)=-===-=-(=((=(-)))==)(=)(-==-=-)--=-(-()-=-()()-)---(=--=-(-(=)-)()=)-(-=((((=)()())==-()()--=()--)=-===(=(==)=)=-=)==)(()(-=))===--=---=--=-()-()--=---((--(=--==))-)-===(=)-=()((-(=-((()(-)=-))-=)==()()(=)=)=()=--(==--=(==)==)(=-)((==(-=-)-=)=-=-=(())=))(==())-=(=)--(-=(--(=-))=--(-(-)---(-(===(=--((((-)(((-)(=-=(=-(------=-)=)--))-)-==))-()--()))((-=((-(-(-((-(--)=((==-=-=)()(==---=(==--(-==)-==(-=-)==))(--()=)-=))--((())(-(()(()==-=---==)=)====((=(=(-))--=))(---)(()((-))(-=-==(=)--)))=())(-(===-=---)-()=)=-=__--(()()(=()))=)(=))((--(=(=()(()(((-(((=-)=-()(_=(=((((--==-=--)=)(--)=(=-(__(=)((=-)=-=(---(-(-()()))-(((=-)(=)-(-=---=--)__=)-=()=()=-)--=((=()==---=()=)()(==)==)(=-=-=-=)((()==)=-=-)=(=-(-=)-()=(-(-)-=-())==)=(=--=)-_)()--=--)))-)()(==)=-)=)(_)-)-(=-(-==)-)-=)-==))-=()()(---)(-((-()-(()(_-=)=--)_=(-(((=)(=(-(=)(==(-__)((==())=-(()=)(-)-()-(==-)()(--)-=(--(()))()--(-(-)(==(--))===(=(=)=())))(=)=)=((---=(()-_-=))-=(=-=(()=)(=(-()=)=-=)-)=((=))))(--)))(-=()-())=-=)))--(()))(=(=(-()))-==()))===--)(==-==-)(((-((-===-)--))-==)-(=((((=(=-==-)===)-(-))(--=-=(-()()=--)=)((--)))(-(=--=()()-=-_=-)(-)=)(-==)=)(--(=(=-)()-=(=-)(==)=)-)=-)((=)(=-)))(((--((-)-=)_)-=))(=((-(()-)=-(=)=))-=-((=((-)((((-(--(()(()-)-=--)((-)-)-(-==()()=)(==)(=)=()-)_))((-=-)=-((-(===-(-((-==())--)((((=(((()-)(==)=(=((-((=)(==)==(-)-(-=--_)-)((-=--=-_=(==-=====))((=(-))()-()=-()(==((()=(-==))((--)=)((==)=))-(-)-)=)=))_))-(=)=-_=(=)(=-(()(-()-)-(====)((-===--==)))(=)())--))-()(_)=(--=((())((-()(=-()--=-(=)--))(=---)_)=(==)==-(==-(-(=)=((()-)---()-)-=--)=(-==--((--)()(--((=(-))=(-)-)--(-==-((__=-=(-(--===(((-=-(=(=(===(()-==(=-(=)()=(-====(=(((_=-=-(-)-)=)--=-(--((-))---=()-()==----=()(=-(-=()__)---(()-)))))))=(-(=-(--)(--)-()--===())(()==((=()==-=-)((-)-(-((-(-=((-)--(---))))-=(=-==)==-))----())-=)=()-=(-)(-=---(()))(-(((=-)=-==)(==))(=-(((-()((-(-()-)====-(--(()()))(---)==()-(--)()))()=()-=-=)-==-)--)()((((=(=((()))(()-=()=)==-=-()(=)(=())-)())))(-)=()))-=-(-()-)=-(=)=((==-==-)(=-(=))()==--()-==-==())-((=-()=-))((=())=-)()(-(((=)-(====)((==)==--=))-(-(===-((=--(=))-(=)=)=(()-))-(==)=)(-((-((()-)((=-==)-)(()))=())()()=--_=---=())(=---)=(=()==---()-==)-=)--(-)_)(-())))=-()(=(-=()=()-((-=)(-())=()(--((-=-)=-=(===-))-()=)--(((-==-((--)(=(=)-)==--))==)-=(-)--=-)-)=)=)(=(=)(-==(==--(=-==)--=)=)))-=-)))---=-=-)--(=)=)(=()-)=)=)==)-=-)(((-=(-)-===(_((()()(--__-(-))=))))))))))))))))))))))))))))))))))))))))))))))"

    Is this a bug or am I doing something wrong?

  • Default User Avatar

    sorry but I think it's coming from your code, I get no exception and all your test and mine pass perfectly

  • Default 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

  • Default User Avatar

    woops, I just tried again and it's good on my side... x)

  • Loading more items...