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.
A good method to transform a list of string to that of number
I think, here freq[10] stores occurrence of specific intiger, and since we have int, from 0 to 9; any array value, for example 3, if occur 5 times for example, then freq[3] index will contain 5. this is possible through freq[*a]++
Puzzled why this passed. There is no given guarentee that the values in |arr| are in [0, 10).
having res, ns, and cs pointers of the wrong type cannot make this a best practice.
This comment is hidden because it contains spoiler information about the solution
Maybe lists are compared like strings?
So what do you recommend, Ali?
Agree with Ali
Yes, that's what happening. In C the strchr function returns a pointer to char, and in an expression every value of 0 evaluates to false (including the null pointer), and any non-null value to true. The ! operator evaluates to 1 if its argument is 0, and to 0 if it's argument is not equal to 0. We need twice the ! operator to turn any non-0 argument into 1.
ISO C17 6.5.3.3
Thanks for answering me. I think you are right. At first, I thought this is a special operator that I'm not familiar with it.
I think the first "!" is to convert the pointer that strchr returns to a number(one if its a null pointer, and zero if the strchr found the specific character), so we can actually add to "int c". And the last "!", is to convert to the right number ,because null pointer was assigned to value one...
I assumed this based on sandoy's commentary... Might not be the right answer.
This comment is hidden because it contains spoiler information about the solution
What does
!!
do? (beforestrchr
)You didn't define
split()
, so how does it work?This comment is hidden because it contains spoiler information about the solution
Loading more items...