Ad
  • Custom User Avatar

    Thanks for the reply.
    I think the first two still don't seem to address the issues of repeated numbers or skipped numbers.
    This seems a simpler solution to make clear all three
    Test.assertEquals(originalNumber("XNFSIONSUXERISXRIOUFWTOIISNXEIN"),"244666699")

  • Custom User Avatar

    Thanks for your feedback. ;-)
    Added these three basic testcases:

    Test.assertEquals(originalNumber("ZEROONETWOTHREEFOURFIVESIXSEVENEIGHTNINE"),"0123456789")
    Test.assertEquals(originalNumber("RHIIHTOOIIZETEXGRVENOUNEEENFEOWTSREVESFN"),"0123456789")
    
    Test.assertEquals(originalNumber("FZVESIXFOUROEVENFEVENEVEHNINEONEZEROIEEENOIXOZOOEVENTHEEHTWOFIIITWESUVEZNINETIREVTWOFTURFIVEONEFOUSVHOEIRHTWWOONESIXFOURTHREESEVEEEIGHTSIXEIGHTTWENINEEIGHTZIROSIXEEROFOUNONESIXNRNEEEREEEEROTEOSHVENNXIESEVENFIEHTSEVENFIVEEWOEIGFZTWHFOURNINEFOURTHRGEEIRETIOSIIOEZENFIEEIESOFIVEEOUGTOETFREETHRIENINISEVENEIGHESEHONFIXEHEEETHREESEVENFNURZEROTHREEONEXNVEETHREITWUNINVTWOZRNOEIGITTWOSTXFIVEWEENRUESIXSIXWUGHTSIXONEONETHUEERIGHTNINENINEONESEXOIEEHEEOZORONINETHREESEVEENINERIVESEVENNINETVREETHROEZEROFOUOSEVENEISHTSONGTHREENINEONVNEROTHREESEVENIHREENINXSTZENSEVENEEVNNZEROTHREENINETHNEENREENEOURFIVEONETEOEIUHTZEROFUVISISEIGHTTEROEFEVTEIRHTZERONINESIXSEVEEFOURTHREESIEONENEETHRHEFIVEFOURTUREESEVRNSEVEXSEVNNTNREESNVETNINEZEROZEFOFOHINOUVTHEEEFIHEONESOVENZWOSIXNIIEOEEONENINEEIGHTTWOTWOEWNSIGHRNEEOFOUROIIHEEIGHTFOVEONNXIVESIXZXRTSIOFOUREIIHWONTFNOSIXNINESUSETROTWOEIGHETWOZHROEIGHTNINEHOUROIGHTZEROTTOFRUROEREESOXNINEFIVENINEZEEOTWOSEVENSEVREFEEREIGHTTHREVTHREEFIVESIFTHRVEEIUHTFOUOSIEFNVETHRVEEWNTWOFIVEEHHHXEINHTFIVRNINISTVENTWOONEFSURFIVEFOUFROUIFOVRTWOZERONIEOTHREETUREREIGHTONEOEETHNEEENEESGHESITTWOTWTSNXZINEOIEENFEVENINETWHWINEZTROFIOESEFFOURTRREENINEFOURFOVTFOURFIVEZEGHTNNNERIXSEIENNENEZEROTWOFOUNFOVVEIGHTONOIEXTHFEESIXENENIXFSXSEVENSEVENNIOEZEROZNEVIXTIREETIGHTFOUEEEEHTFOUGFIVETEEROIVZOVNEFIVEWNEEIXNINESIXEIGHEEEGHTNIGTTTHREEOWOTWEUHEEETHEEETWZZNROONEZEROFWTETWOTWOSEHIEREETWOTWISEZENOIIRZFROFIVETWTSSXSEVENZEROEIGEIGHTTHRIETHREXONEOHREEONEIIXNINHTHREENINVSIXTEOEEZERRZEROEENOZEREEEZERFOURSXXTORXENINEFIVESIXOEREEIGHTEIGHFTWOOWOONESERNNONEFOENSEVINZEROSEVENNINEZEROZRVENVIGHTWTSHTONVFIOESEVENTHREEIITEOOURTHTEEEIGHTTWUONETWOSIXTHRIEUEVENTWEFORIFIVEEEGHTNINETWOFOURZEROSEVEREIGHSZEROFOURSEVENROFRFNURVEFOZEEOSIXEIOEFOURIIEEVEROTWOTTTZEOOTERTETWOEIGSTFIEERGVEESEOENTWONENENINEFOUREIUETZFROTHREEEIGHTONEEIFHTIIVENINNVNESEOTNFIVETIGHTZERVFOURFIVNTWOFITWFXNEOEEZEROONNTWFFNURSIXTIREENINETWOTWOONININEEIGHTFIVEFOTRSIXROUEFIEENINHNINETWOGHREETHEEEEWOONEETGHSZERONINUSIXTTOTWOFIEETHEEETWOXEVEISIXTHREVZEHOSHVGNONEFOURTEIGEVEEUFGHVEIVERNISENENTHSEENHNETWOEIXSIEFOURTHREVTHREEZEROFIVEONENINNTHREETIVORESEVENFVGRNITESENFHIVEZEEESSXTHOEEEIGFTIWOONENINFEIGHTONEEEGHTSOXWEROSEVENHHRRESIXIHREEEHREESEFENNIOEZEROEIGHTREROTWOSEVENSEVENONETHSEESEXTWONINEZEROTWOFHVETWORUXTHREZEIVENERESHVENTFOTWOSEVHNSEEENHHRHVZEROHINESEVSSFOIRTWOTWOTHREETHRENTNREEROIRFOURSEVENTHREEEIGHTTGREESEVENONSOOVENONEEIGETEERHTWHEEIONESEXONEZEROZEROFNVESEVENONNEIGHTTEREEIHREEIERONIOESEVENSIXTWOZERTOIVESIXEIGHNWHREEONEFIVEZEROSHREETWOZEROSEVENFIVETHREETWOTWONINESEVWNZEROSVXEIXEIGHTTWOTWONIIEIEVENRHROONEONEONNFOURTHREEFEVEVRGTTTWOSEXHTRETHRTEZRUXSIXINESRVTNONTNVHETHREEVIVETHREEFOWRRIGHTSEVENSFXFIVEEIGHTNEEINHIGHTTHRIEOSENINEOEESISWEROTHIEESIIEIGHEZIRORHNEESEVENEIGHTFOURNINEFITEFNEENHNVEIXHTONETHHERNONESEVENNINEONEOIXFOURREVENRIXSEXONTSIXTEROETHREISEVZNOEROVWROONETWOOWOTWOTHREEFNVENENENINEEOEESTHREOZEROUIXEIVENOORSEVENOIGGTOIENINEONERSSSIXRINEZEROEIUEFOURONESXVENTEREIENNORESIXNGNESIXTWZSIRVEROFOURZIGHTFIVEFIVEFEEENTNETVREEEINESIXONEONNFOURONOEEGHTTHREEEINETWOFIVESEVENNINETIVEFOUETWONINESEVENONETHINENINEFOURONETFREETHREETWOFIVNFOURSEVENTHROEONSSVVENFOEHSEVENEEROFIEHSWONERSFEUOSGVENFIVESEVENTHREEONETIGHTNINIZENONINESIXZERFFIVENIGETHRREEIGHTTHREEFIREOIGTTEIGOTSEGENFOURSEVENOTESVXFIOEEOGHTORETHRXNFOUSNTTETWONINESIXTWSFEROSEWENNINEONVHONRONETEREEFIVEFIVESEVSNEONHTNINETHREOFOURFIVEONEEIXSIEEIGHTSIXSEVEENINETWETHREEOWOFOEREIOZERSRNETNRONEOSEVENSIETEVZNOHREXFOURRIGHTTWIZEROZVROSIVFOURFSSRINEHIVENINESEVENFIVIFOURSEXIFRSSEVENNHRSEFIVETHREESEVENFIVERIRENREETWEONESEVENSEVENFIVRSIXNINEZOROVNENINEFIVEFIVREIGHTGEVENIFEOFOURZEROZEROFTUSNINISTXEHTWITWFTOEEESTSENREOENTWONINIFRUROVENITEFIVGONEOSEFEIREWVONETWONINEFIEEIWOSEVENEIGHTTWHSIXOEEONEFOURFIVEOIGHTZERONINEIWOTTNEESIXTIGHTENEEIGHTTUOZEROTWHRIVENTNEZERONINETEOEEVENZEREFINEZERTONETFVOEFONENINENITENZNEOIEFSIEUWNTWOEIGHOSIXZEROZEROTWOFXGRTHREETEROIIVESIXONEONENINEEHREEVUVENFIVEONETHOEEEIEHTSOURFIVTONEFOURSIEENTOZETSIXTWONINESIXNINEFXEREIEEENTVEFZEROEIGHTNINEZEROSNXOWOEIGHTFEUREEREZWVE"),"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333444444444444444444444444444444444444444444444444444444444444444444444444444444444444444455555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555566666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888888888888888888888888888888888888888888888888888999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999")
    
    
  • Custom User Avatar

    For a clearer explanation, it might be worth including in your examples things more complex than "TTONWOHREEE"
    e.g. give an example that does not begin with 1, give an example that skips numbers in the sequence (349 etc), or perhaps give some numbers that have a repeating adjascent numbers (e.g. 244666699) etc.

    I understand that you don't rule out the possibility of any of these happening, but for clarity's sake, particularly for those whose first language isn't English, it might be worth either showing (in your example numbers) or saying explicitly that the above examples are possible.

  • Custom User Avatar

    Alternatively:

    Look at the JS version, there are already 68 people who solved the kata, so clearly this kata is possible ;-)

    If you find yourself unable to pass the kata, perhaps you need to git gud and try harder?

  • Custom User Avatar

    I think that you are not completely understand how to solve this kata. Trust me, there is no combination, also no different result. Each testcase can only got one valid result.
    And, to find a correct way is your job, not mine ;-)

  • Custom User Avatar

    Should I add: the input string may be very long, perhaps someone feel complex, but In  fact, it doesn't increase the complex of your code.

  • Custom User Avatar

    Should I add: the number may contains all digits. all digits means 0123456789, instead of 123.

  • Custom User Avatar

    Well. Please tell me, what thing I didn't written in the description? I will add it to the description.

  • Default User Avatar

    Err... Oops I forgot that (should I say that I solved it only yesterday...? ;-o )

    @ Amber: so I think you just didn't use an enough general approach, restraining you to the example tests. "Think larger" (especially with myjinxin's katas). ;)

  • Custom User Avatar

    input is a string. I think his trouble is random test too hard to solve, but I don't think so ;-)

  • Default User Avatar

    What Voile was telling you is that, without more descriptions of what you call "failing random tests", we cannot even know if your complaints are "valid ones" or not. Meaning: what is the fail exactly? Because your trouble looks dangerously as if you were mutating the input array and, in that case, your "complaints" would be fully not valid.

    So, are you mutating the input, by any chance?

    BTW:

    ...like you did

    Voile isn't the author of the kata. ;)

  • Custom User Avatar

    ???

    You didn't point out what needs to be improved so that actions can be taken. How is that going to help anything?

    What does "all types of examples" mean? What is "unnecessarily trying to increase the complexity of kata"? Unless you can only count from 1 to 3 or can't spell beyond 3, it's impossible to happen I think?

    "Random test cases are failing" is not an excuse for saying kata descriptions are bad. In fact, the random tests are already showing the inputs, which is even better than standard practice:

    Testing for:
    s = "UIRWTOFSUOXFRO"

    If your code fails the random tests, unless you have definite evidence the kata is wrong, it's always going to be your fault. (Also, look at the 31 solves!) I don't know where this amount of arrogance from you come from, but it's not helping, and it's so condescending I can't help calling you out. That's not how one goes to get things done and improved :(

  • Default User Avatar

    While this can be done without using Strings at all, from looking at your code snippet I'd suggest you review your loop conditions.

  • Custom User Avatar

    Think of the solution where you don't have to use strings at all.
    You have a number and you can use arithmetic operations to get its digits. That should be faster.

  • Default User Avatar

    Make sure you exit any loops initialized

  • Loading more items...