Ad
  • Custom User Avatar

    nah, then I would have hacked my way through to the answer from the testing method using reflection.

  • Custom User Avatar

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

  • Default User Avatar

    I managed and I am very happy!
    I am the number 25!(in Java)

    Thanks :)

  • Custom User Avatar

    (Deleted. I made a mistake)

  • Custom User Avatar

    There're 24 Java solutions. Now ask yourself, did they somehow found a workaround, or their code can actually compute N(5000) before timing out?

    And don't forget there's Python which is A LOT slower than Java but the requirement is also N(5000).

  • Default User Avatar

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

  • Default User Avatar

    aaah ... I found the guilty man of my tonight's(useless) optimization night :D

  • Default User Avatar
  • Default User Avatar

    ( This comment makes no sense, since I completed the Kata. Deleted!)

  • Default User Avatar

    Dear Sensei,

    somehow I managed to pass all the Tests ... but I was not really happy with my solution.
    Yours and Voile's solution are wayy better than mine.
    But that's exactly the reason why I am here, to learn from the best and improve( and to train myself for the Google's interview, but that's a different story :D ).
    Looking forward to challenge myself with new Katas :)

    KChallenge

  • Custom User Avatar

    My alogrithm is also a trying process, just like yours, but perhaps doing more tries than yours.
    I write it below this comment, and mark it as spoiler.
    You can reply it and read it.
    Please wait.. I'm writing..

  • Default User Avatar

    Dear Sensei myjinxin2015, I am trying to solve this Kata because I didn't manage so far to solve the bigger brother https://www.codewars.com/kata/the-position-of-a-digital-string-in-a-infinite-digital-string( my Algorithm isn't fast enough), and you said in a comment this could be a preparation for that one. About this one: I developed some very complex Algorithm to compose multiple combination of numbers starting from the source string( for example, scan the string from the first char to the last, create blocks, check if the string composed by blockN + blockN+1 contains the input string). By now, I don't manage to cover all the tests, I pass circa 90% of them.
    For example I fail in this one:
    n = 37518333
    I get "3337518" in place of "1833375" because somehow my Algorithm fail in composing this particular combination of numbers.
    Btw, I don't want to bore you.
    My question: could you give me some suggestion to solve this one? For example: I am thinking in the right way, this block composition strategy stuff? Or I am completely in a wrong way?

    PS: I know that I could brute-force this very easily with a simple for. But I don't want to bruteforce it. I want to solve it in a smart way.

    Thanks a lot :)

  • Default User Avatar

    Wonderful Kata! I managed to implement a correct algorithm but ... it takes way much more than 16 seconds to execute!
    Just as an example, this test "555899959741198" must give a result of "1686722738828503" ... that's a huge number, just only to iterate.
    I have to figure out something to make it super efficient, otherwise I will never manage to stay within the 16 seconds!
    Thanks for this Kata ... I hope I will manage to make it.

  • Default User Avatar

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

  • Default User Avatar

    This is very tough ... I am getting mad. Am I supposed to use reflection?

  • Loading more items...