Ad
  • Default User Avatar
  • Default User Avatar

    closing since it's a question, not an issue

  • Default User Avatar

    On one side I feel bad for not figure this kind of solutions out just cuz' I forgot certain lang feature exists, on the other side I love checking them out to see how they work.

    But hey, practice makes perfect

  • Custom User Avatar

    you mean recursive function, do you?

  • Default User Avatar

    Welp, fair enough honestly.
    I guess people just put all their attention on one step that they forget what result they were searching for in the first place.

  • Custom User Avatar

    The instructions are not that long, read them again, what you should return is there, how can you pass that? Besides,you have sample tests to see what your function should return. People should read better.

  • Default User Avatar

    You should leave more clear you need to return the number of steps to get the persistence and not the persistance itself, I know is stated up there but it's easy to pass that part when reading and when you concentrate on the solution.

    At least letting at the end something like "You must only return the amount of steps you took to get the persistance", so there's atleast less people asking the same thing over and over.

  • Default User Avatar

    i did something similar but using log10(x)+1 to get the digit amount, now I feel dumb for not thinking of this

  • Default User Avatar

    Thank you. I totally forgot it returns unsigned

  • Custom User Avatar
  • Custom User Avatar

    I was having the same problem, it turned out to be when the vector is empty and we subtract 1 from its size, the comparison in the for loop doesn't work as we expect because v.size() returns an unsigned, and the result of 0 - 1 ends up beign a big positive number instead of -1

    Oh man, I love c++ hahah

  • Default User Avatar

    So i'm trying to solve this on C++, it passes all sample tests but when it goes to should_pass_all_fixed_and_edge_assertions it stops with this error:

    stderr

    UndefinedBehaviorSanitizer:DEADLYSIGNAL
    ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000004 (pc 0x000000425620 bp 0x00000259e800 sp 0x7ffe7ee1bd40 T1)
    ==1==The signal is caused by a READ memory access.
    ==1==Hint: address points to the zero page.
    ==1==WARNING: invalid path to external symbolizer!
    ==1==WARNING: Failed to use and restart external symbolizer!
    #0 0x42561f (/workspace/test+0x42561f)
    #1 0x429751 (/workspace/test+0x429751)
    #2 0x426bbe (/workspace/test+0x426bbe)
    #3 0x426703 (/workspace/test+0x426703)
    #4 0x42633b (/workspace/test+0x42633b)
    #5 0x42da35 (/workspace/test+0x42da35)
    #6 0x4259ed (/workspace/test+0x4259ed)
    #7 0x7f2cdb2fdc86 (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #8 0x4046a9 (/workspace/test+0x4046a9)

    UndefinedBehaviorSanitizer can not provide additional info.
    ==1==ABORTING

    Someone has any idea what could be triggering this?

  • Default User Avatar

    im not too familiar with python syntax so i just write what though it would work, now i realize how inefficient this is, but im gonna let it like that anyways :P

  • Default User Avatar

    In case someone ask: I use "..." operator to split the string characters in to an array and then inverting and spliting that, in this way it works with unicode characters too.

    some unicode chars really consist on two symbols, making split() taking it as two diferent characters, which can lead to incorrect results, for example you can try to see what this code returns on the web console:

    console.log('foo 𝌆 bar'.split('').reverse().join(''));
    // -> rab �� oof
    console.log([...'foo 𝌆 bar'].reverse().join(''));
    // -> rab 𝌆 oof
    

    So at the end the kata just use ascii, but i think is always a good practice ensure things works equally no matter what anyway :P

  • Default User Avatar

    I think "base % factor = 0" is evaluated as statement, who returns either TRUE or FALSE on each row depending on the result with the values of that row
    im kinda new to sql so someone correct me if i miss something