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.
This comment is hidden because it contains spoiler information about the solution
Kata solutions teach me more than any reading I have ever come across
Well it is not super unrealistic as this code could be run under the Win16 API on a 32-bit Windows system (or an old DOS machine), which only has 16-bit
int
s.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Will not work if the number of identical characters causes an int overflow, +1
Не будет работать, если количество одинаковых символов вызовет переполнение int, +1
wow
This comment is hidden because it contains spoiler information about the solution
hint
This comment is hidden because it contains spoiler information about the solution
Funny why I never think of this. Nice One!
yeah me too
There is no need to copy the whole string (not to mention copying the word a second time).
There seem to be a lot of string copies in this. Why not just do the allocation and copy once, when you've found the largest-scoring word?
If n is negative (i.e., < 0) then the for loop will simply fail to execute since the condition "i < n+1" will be false (as i is set to 1 initially, any negative number + 1 can never be > 1).
Now, the value of s is not altered and is returned as such (i.e., 0).
Loading more items...