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.
This solely depends on your method of detection. This could have been a good kata if it weren't for the stupid exception cases.
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
It's not a bug, it just performance test...
You went over primitive range.
For a new pple, exceptions should be created outside
SoulutionTest.class
like a regular multiple classes in one file.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:
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.
@achtlos ..
Indeed, sorry for that. Correction made
Mark your comments as spoilers if you're writing anything that can giveaway the solution.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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.
Sorry but your string doesn't throw any exception. I got 38892296835628857864 if you want to create a simple test case. Good luck
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?
sorry but I think it's coming from your code, I get no exception and all your test and mine pass perfectly
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
Loading more items...