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.
same to same with different words
the joy of coding 😂 feel your pain
The expected output is in string.
expected [ { name: 'red', id: '1' }, { name: 'yellow', id: '2' }, { name: 'black', id: '3' }, { name: 'white', id: '4' } ] to equal
'[{name : 'red', id : '1'}, {name : 'yellow', id : '2'}, {name : 'black', id : '3'}, {name : 'white', id : '4'}]'
Can any one please help me
i tried to find fking mistake about 20 mins in my own same code. I wrote
Javascript
instead ofJavaScript
....Approved
You forgot to add quotes around names and id, not a kata issue!
python new test framework is required. updated in this fork
Look at my faster solution without explicit sort. )))
The expected test results should probably be more like:
"[{'name': '1', 'id': '1'}, {'name': '2', 'id': '2'}, {'name': '3', 'id': '3'}, {'name': '4', 'id': '4'}]"
Regex to the rescue. Most times brings you clean, simple and readable solutions like this to table. Well done!
The overall time complexity of this solution is O(N!â‹…NlogN).
Brute force should've been stated in the description of the code, but it does encourage people to write more efficent code.
I initally decided to generate all of the permutations and then give back the next biggest one but tests stopped me from doing that.
Not the most efficent one but probably the cleanest.
Although some comments would've helped
This comment is hidden because it contains spoiler information about the solution
Loading more items...