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.
O(2^n) as it seems to me, in a really-really worst case:
when at each step you have to explore both trees to full depth (or near full).
A very clever and concise solution, though maybe Java strings will add unneeded worktime too:
substring() is O(length copied), not O(1).
You should correct the tested method name(shiftedDiff) to match method name(shifted{underscore}diff) or vice versa. Unless adjusting the test code is part of the exercise. :)
Hi,
Test case works on my computer but not on the server. It tells me that I need to return -1 when I am returning 0, but in actual fact, I know I am dropping into the condition that returns -1 since I've attached print statements. Any ideas why?
Cool. That's what I thought as well. I always fall into the trap of striving for extremely efficient solutions; should have realised that this has a high lower bound. Thanks for the quick reply!
I'd guess it's about O(n^2) for worst case scenario. Slightly better, since it can drop out at success/certain failures even for worst-case, but O(n^2)'s going to be the best estimate. But, for this type of problem, I think that's always going to be the case.
Azuaron, do you mind stating the time complexity of your solution? I have a vague idea, but I am not too sure.
Still has not been fixed.
Hi Alex, I still do not really get your explanation. How does the bitwise OR help preventing an infinite loop here?
Hum, I'm not really sure, I'm fairly new here. I did mark the issue as resolved on my side, however it is still counted as issue.
Thanks for checking it at your side!
Hi! Yes it is resolved! I don't see any button to resolve it on my end. I think it should be something you do. Am I wrong?
Hi, I think I solved the issue but it still shows up. Should you be closing the issue too?
I've added a few more test cases: in particular tests that deal with border cases.
Marking as resolved, however if you have in mind some specific scenarios that might fail please let me know.
thanks
Thanks, approved!
I've created a javascript translation if you could approve that that would be fantastic :)
Will be great if there are more test cases.