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.
Thanks!
Yes, I think making the random test cases will probably be the hardest part.
I'm new to making katas, so we'll see how it goes.
I'll let you know when I have a beta version working.
@myjinxin2015 - Wow, spectacular kata. Seriously hard, but fair. Thanks!
Would you mind if I forked this to create an easier version (or versions)?
I ended up using three different algorithms in my solution, advancing to a more complicated algorithm whenever a previous one got stuck.
If it's OK with you, I'd like to create a version of this kata with solutions that could all be solved using the simple algorithms only, so other users could start with the easy versions, then work their way up to this hard one.
What do you think?
Thanks. I posted my favorite 61 character solution, which uses a completely different technique.
This kata's still really tough though. I rated it 4 kyu, but I think it might be harder than that. I've completed other 3kyu and 2kyu katas in less time than it took me to solve this.
I enjoyed this one a lot, but it was really hard.
Would you consider accepting solutions a few characters longer, perhaps up to 65 characters?
I got stuck at 63 characters, and then again at 61 characters, before I finally figured it out. Allowing solutions up to 65 characters would still be challenging, but would let people solve it in some different ways.
Your TypeScript version appers to be broken.
I get the error:
In the example tests I fixed this by changing:
to
but I get the same error on the full tests, which I can't change.
Could you please fix the full tests?
Fixed.
Thank you.
This comment is hidden because it contains spoiler information about the solution
Thanks. Yours too. :-)
Heh. That would be nasty.
Contrary to the description, I don't want this kata to be impossible. In fact I'm hoping most people will find it moderately easy. (I expect it's somewhere in the 5-7 kyu range. It will hopefully look really hard at first, but once you figure out the trick it's actually very easy.)
I like the idea of random tests, but I don't know how to implement them wihtout making the kata actually impossible. The function doesn't take any input, so there's realy nothing to randomize. (I suppose I could create a section labeled "random tests", with tests that aren't really random, just to intimidate paople. But that seems a bit unfair.)
I made this kata mostly as a joke, after I had to use this technique to solve a different kata which really was broken (and has since been fixed). Perhaps if enough people like this kata I'll make a slightly harder followup which uses a function that does take input, and make random tests for that.
If you know how to add random tests to this kata without making it unfair (so just adding tests, without changing the solution), let me know.
Yep, misreading the description was entirely my own fault.
I guess what threw me was that the problem only showed up in the random tests.
My original solution is actually incorrect, because it sorts by bar lengths, not counts. (I got it through by re-clicking "Attempt" until I eventually got a random set of tests where that didn't matter.) I've now re-factored my solution to sort correctly by counts (and also to fix a rounding error I discovered once that was done), and it now passes 100% of the time.
Ideally, it would be great if this kata also included standard tests for those edge cases (which would also prevent others from getting incorrect solutions accepted, as I originally did.)
But either way, it's an excellnt kata, and I learned a lot. Thanks again. :-)
Yes, that makes much more sense. Thank you for explaining.
Re-reading the description, I see now that it says to sort by the actual occurances, not the bar lengths. Though doing that makes the bar graph look like it's sorted wrong (even though, as you point out, it's actually sorted correctly). I've changed my "how satisfied" rating from "somewhat" to "very", because missing that part of the description was my fault.
I wonder if addin an extra line to the description reminding people to sort by the occurances, NOT the bar lengths, would help others avoid getting frustrated in the future?
Anyway, excellent kata. Thanks!
I think there's something wrong with the sorting in the random test cases. Bars of equal length are not always sorted in alphabetical order. This result is random though, and doesn't always happen. Could be not correctly lowercasing all the letters before sorting?
Excellent kata, but I thought it was harder than 5kyu.
I had to solve it twice, first for the examples, and then with a completely rewritten version for the real tests when my initial implementation turned out to be too slow.
The description warnes about not wasting memory, so that seemed entirely fair - and I learned some important things about how to write efficient recursive functions (don't declare new variables if you don't have to...), which was great.
Maybe this kata is easier for programmers already very familiar with with currying and recursion. I just found it noticeably tougher than I expected for 5kyu.
Fun. Could use some more tests and a bit better explanation, especially about how to implement reduce and the order of arguments for the callback funciton.
It worked fine for me.
Fun, but seriously easy. I'd rank it 8 kyu.
Loading more items...