Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If p points to anything then it cannot be a null pointer because it pointed to something!
meow meow
This comment is hidden because it contains spoiler information about the solution
thanks for the feedback, there was a function name written wrong. now everything should be fine
This comment is hidden because it contains spoiler information about the solution
@meonu, because
x
can become very large given largenum
meow
oh i see! Thank you!
In cases ilke this, I mostly put the parentheses in to remind myself about the precedence of the '' (in partucular).
This comment is hidden because it contains spoiler information about the solution
Thank you so much for your feedback!!! I've learned a lot!!
In the random tests
arr2
is the expected solution,arr
is the result of yourDuplicateEncoder
function.!strcmp(arr, arr2)
is false if the two don't match.I just submitted my solution successfully, and also didn't see an obvious error in the tests.
If your problem persists, please post your solution here (and make sure to mark it as "having spoiler content").
There are several problems with your approach:
malloc(strlen(str))
doesn't allocate enough space for the string and the terminating'\0'
.p[i]
andp[j]
you only convert the first one to lowercase.DuplicateEncoder("aA")
andDuplicateEncoder("AA")
should both return"))"
.*(res + i)
accesses unknown data, possibly even a')'
.Also, why the complicated
memset(res + i, ')', 1);
instead ofres[i] = ')';
?Did you modify the argument instead of allocating space for the result?
Loading more items...