Ad
  • Custom User Avatar
  • Custom User Avatar

    Old kata syndrome, re-ranking them is not possible now due to the excessive amount of solutions that is associated with legacy code in DB, but it will be addressed soon as admins and the CW team are aware of this ^^

  • Custom User Avatar

    I am having issues with indexing, my logic should be correct but it still gives the wrong answer, anybody notice some stupid mistake i might be making?

  • Custom User Avatar

    why is this kata so high level, was not 5 kyu difficulty kata imo.

  • Custom User Avatar

    Thanks for the response, i knew about that integer thing but didn't use it.

  • Custom User Avatar

    some mistakes that i see:

    • you allocate size bytes, but then you access ret[size], this is an out-of-bounds access, the last character is at ret[size - 1]
    • ceil(n / 2) is equivalent to just n / 2, since you are diving 2 integers
    • the diamond must have a trailing newline (\n), but you are not adding one
  • Custom User Avatar

    Think i am making a mistake somewhere but i don't know where, any suggestions or possible mistakes i could have made. (in C)

  • Custom User Avatar
    • r, g and b can be negative. The format "%x" takes an unsigned integer as input, so you are printing a very large number after reinterpretation of the signed int as un unsigned int. Since the output string has enough room for 6 characters + 1 nul terminator, you are writing out-of-bounds, which causes chaos in the tests suit
    • sprintf(h, "%c", '\0'); appends 2 nul characters to the string, because sprintf() always nul terminates its target string after finishing the printing. same problem as above, you are writing out-of-bounds
  • Custom User Avatar

    Solution worked on other IDE but here returns "r = 0, g = 0, b = 0 expected "��E�H�� ]�fD", but got "000000"" witch is more than confusing.
    Anyone else had the same issue if so what is the fix, i think i'm messing with the memory addresses that the test function uses.
    (in C)

  • Custom User Avatar

    simple as that... nice one