Ad
  • Custom User Avatar

    It may seem a bit long but this is because I make a point of returning an array that has the right size instead of returning an array of size n1.

  • Custom User Avatar

    I like the use of goto, it makes it quite readable (allthough all C courses say NOT to use it :-)
    Another thing is that you are returning an array that is bigger than necessary which I guess would be ok for performance
    but is not optimal in terms of memmory management. If your function was called repateadly on a big arrays it could lead to memmory exhaustion
    I guess.

  • Custom User Avatar

    he need change the value of ret

  • Custom User Avatar

    That's because you're new to C, not new to programming.

    If you can do this kata in one language, then it's pretty easy to do it in another language. It's coming up with the initial solution, when you've had no experience doing a problem like this before, that's harder. It doesn't require anything special with a lower level language like memory management or using different types. The difficulty comes from creating the algorithm, and realising what you need to do. I remember spending hours trying the do this kata, when I first started on Codewars, before realising the 'correct' way to solve it.

    It used to be 4kyu anyway, and has already been downranked once.

  • Custom User Avatar

    This kata is from 2013, back then maybe the ranks were different than what they are today. The rank can't be changed anymore for powerusers, only admins can do that now. You'll find more old katas overranked.

  • Custom User Avatar

    Not here to brag but isn't this kata surprisingly easy to be ranked as 5 kyu ?
    I am kind of new to C and this the kata that has been the most easy to solve for me, took me two minutes to complete.
    No need for doing math, for minding types, or to even look for yet unknown functions from the standard library, no memory management, no index counting... I am just surprised is all.

  • Custom User Avatar

    Your program seems to assume the shortest word size is 1 but although the instructions says s will not be an empty string, a non empty string can be "(god knows how many whitespaces)" and has no word so I assume the minimum word size can be 0.

  • Default User Avatar

    The kata asks for the first day the evaporator stops working. Before rounding, the formula gives how many days have passed. Days are typically counted starting from 1. So for day 1 it gives some value between 0 and 1; for day 2, a value between 1 and 2; and so on.

  • Custom User Avatar

    How did you know you had use ceil() and not floor ?

  • Custom User Avatar

    This is why I want to be better at maths for.

  • Custom User Avatar

    This solution won't work if n>999 because s char array declared in the loop will have no room for 1000 and more. Since an int can go up to 2,147,483,647, you would need to declare char s[20] for your function to be fully working.

  • Custom User Avatar

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

  • Custom User Avatar

    Is it really necessary to cast the return value of calloc to a char* ? Doesn't the assigment make the conversion implicitly ?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Loading more items...