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.
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?
I have a problem with the random tests. One input is expected an array containing of only one element e.g. [278] ... console says that expected output should be <-2147483648>. Is this a bug?
This comment is hidden because it contains spoiler information about the solution
Thanks man! Definitely answers my question. The central idea of your solution is for me personally, that you are substracting the sum from both sides of the comparison, which makes the solution so much simpler. Cool.
Hey Johan,
I do not get this solution. It looks clean, I understand the code, but I do not understand the logic behind it. How did you do it?
regards,
Paul
Sorry, I am new to this site. Where do I write print(num)?
I got an error: "XCTAssertEqual failed: ("1") is not equal to ("2")".
Why is persistence(for: 1) -> 2? Is there a problem the Swift test?