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.
it seems like if there's a real large string, it's gonna have to fully convert it to upper case and compare. i guess a for loop with an early return false (in case a char is lowercase) would be the best practice in terms of performance
Interesting, converting the string return value of
.ToUpper()
to a MyString type instead of converting the MyStrings
to a built-in string type. I'm curious if there's any particular advantage there, or if it just keeps things a little simpler on one side of the equation?This comment is hidden because it contains spoiler information about the solution
How does the solution have to call a more complicated function? sum() is not more complicated than your solution--it eventually resolves to a while loop that simply loops over the iterable, accumulating the sum along the way, and then returns it. Your solution, on the other hand, recursively calls itself n-1 times, setting up a new stack frame each time, and consuming n frames on the stack, which is resource-intensive in both time and space. Your solution isn't even tail recursive, so tail call optimization cannot be used to reduce these costs.
not seem to be a good answer ,(although short)as it has to recall a more complicat function which takes more resource
but not for hugh strings efficiently
I thik its innefficient on very hugh strings. Better check one rune by rune to get Unicode-16 full
oh. how simple the solution can be... I worked with arrays and runes. hahah
why use call instead of init, it seems that the test code only initializes LazyInit class
Thanks for replying, I'm already update my solution.
It seems you were just lucky with the random test cases. I added a fixed test which would not work with your solution. Thee is a problem when the same letter as the first letter of the intersection is right before the intersecting section.
I wonder if you're aware of the issue that Blind4Basics has raised for this kata?
I'm not sure what it's about -- perhaps not everyone has given a suggested rank for this kata. Anyway, I thought that you might like to look into it if you want to get the kata out of beta.
thanks, i think you got the best method, let's see who else goes that path
Nice
thats what i`ve wanted to write but cant
Loading more items...