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.
BETWEEN every two blue beads
Thank you for checking out the kata! It seems like you are only downcasing the uppercase vowels. You should additionally upcase the lowercase vowels as well.
For this kata, unique means that each character is repeated only once.
For example, "abc" is valid, "abca" is not ('a' repeated twice)
For both of the allocations you assembled (one in your comment -->
malloc
and the other in yourView Solution
-->calloc
) you need to review what are the proper expected parameters for those functions to use them correctly, that's all. Hope you get this, best of luck!Haven't you forgotten something at the end of your string ? ;)
As you know in base 2 all odd numbers has the LSB (Least Significant Bit) set at 1:
0 : 0
1 : 1
2 : 10
3 : 11
4 : 100
5 : 101
[...]
On the other hand the number is given you as a string, aka a character sequence, and the characters are represented in ascii code, thats an integer. In the ascii table the digits representation starts with the 0, then 1, 2, and so on. The ascii code for '0' is 48, so while the digit is even his code is even too. That means I don't need to convert the character to its value to know if the digit is even or odd.
Well, I have an array of sums: sums[0] has the addition of all evens and sums[1] has the addition of all odds. I will use the digit itself to know if it is even or odd:
*digits - I take the digit of the string (his ascii code, remember)
& 1 - I take only his LSB. If it is 1 then the result of the operation is 1; If it is 0 then the result of the operation is 0. I use the result as the index of my array sums.
Why not? There's no difference between 132 and 0x84!
And yet your discord settings do not allow to add you... So better add uniapi instead
This comment is hidden because it contains spoiler information about the solution
Please use the
spoiler
flag when posting code in the discourse.Cheers.
Not an issue. Post as question.