Ad
  • Custom User Avatar

    assertEquals(13, Cable.caculateLength("(-())="));

    (-())= equals 13

    2 * 1 + 1 * 2 + 2 * 3 + 3 =
    2 + 2 + 6 + 3 = 13

  • Custom User Avatar

    This solely depends on your method of detection. This could have been a good kata if it weren't for the stupid exception cases.

    If a cable is both broken and contains nodes then it should throw the exception that can be first detected and confirmed.

  • Custom 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
  • Custom 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.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom 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.

  • Custom 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?

  • Custom User Avatar

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

  • Loading more items...