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.
Hello, can I please have help with this problem? I don't know how one is supposed to know if the anonymous function passed into the constructor will have any values or not.
Additionally, I don't know how to make the dependencies in this.dependencies match up with the the array literal inside of the anonymous function.
What I have done thus far is converted the this.dependencies object into an array, and then made a call to the anonymous method using the .apply method. (which is wrong).
I'm at a loss for how you are supposed to solve this. And researching "dependency injection" just lead me down a rabbit hole of other things like "inversion of control",
"unit-testing with Mocha", "promises", etc. Any hints would be greatly appreciated.
Hello guys. can you tell me what the run time of your solution is? I think I have an O(2n) solution and my answer is also timing out.
[UPDATE] I optimized my solution to an O(n) answer and its still not enough ;_; Is this broken?
[UPDATE II] Okay, I optimized my O(n) solution so that it is no longer an exhaustive o(n) solution. I used a forEach() loop instead of a for() loop and broke as soon as I had my pair.
Hi, can I ask you something? Do you know what the runtime of your solution is? I'm using two reduce methods (1) to populate an object, (2) to find all instances where the sum of the current value is being matched with the difference of the current value and the sum. And accessing that sum is being matched by the object I have constructed earlier. I believe that my solution is O(2n), I just want to know what yours is because one would think that an acceptable solution would be O(n).
I too would like more directions on what this kata is even asking. So I'll just throw this comment in to draw more attention it it!
Oh yeah, I understand it now. I was just fresh 6th kyu who wasn't used to writing unit tests at the time lol. And dude, congrats on getting that 1st dan placement! Epic!
I don't know if it is just me but I cannot console.log anything and I cannot see the values that I want to return. This testing stuff is the thing making this question hard but not the problem itself. This is for JavaScript.
I would like to inquire this as well but are the tests still failing for this particular kata? The tests seem to be reversing the order so it is saying that (Tests 0,0,1,0 ==> 2 Expected: 4, instead got: 2) which is not true at all. Basically, a lot of the tests are asking for the answer in the reverse way. This problem happens for me in JavaScript.