or 'friend' :)
I used filter too, glad to see it is one of the best practices
i use .filter() to, glad to see it is one of the best practices
OP solved it, closing
It was not easy, I work with a paper a long time and finally i found the pattern bu my self
No, it is not, read the kata description again.
if this value = 1904 -> your algoritm = century 20. is false... 1904 is century 19.
didn't think of using arrow notation to make the function even shorter ha ha thanks for this !
It's not necessary because I'm returning a pointer to a string literal. As to whether it's good practice, it depends. If you're returning a label from a pre-defined constant set, there's no point in strdup'ing it. If the returned string varies with arguments (e.g. "Your name is %s"), then the result has to be allocated or created in a output buffer.
It is, however, a good practice to tell that in the kata description. In this case, I had to infer that from the test snippet, which didn't free the result.
How come it is not necessary to allocate memory for the returned strings? I see that it works but is it a good practice?
What more would you want to know? Look for bitwise operator and you'll find many stuff about that.
How does it work?