Hi guys, not sure if any of you are on CodeWars already (in case not, join from here and we can follow each other), but prompted by some other veteran users, I created this and wanted to challenge everyone passing through this place.
Once you are done, I would be very glad to discuss the different solutions here
It was not when I started, but in a few months of constant training it became such. I remember being close to despair about regexes, thinking I will never learn them for good, but nevertheless I forced myself into it, time and again.
Last time I used them, was to teach them to others
I really like your solution Giacomo, lambdas are somehow always impressive But my way of calculating average is visually neater (in my opinion)
I remember how 11 years ago I spent whole three days trying to solve this problem -> https://projecteuler.net/problem=67. It was very frustrating three days, but this aha moment will stay in my mind to the rest of my life. Beauty of algorithmics
Well, most of my solutions ignore or even eschew readability; I would never use something like that in production, but, hey, it’s competitive coding here, so let’ have fun and show off
For you people, like me , who can be put off by competition, don’t worry about that part.
My personal goal, for now, with these is to get the task accomplished with code that you would not groan about if you were the person that took over maintenance of my apps/scripts.
Once you have submitted your solution, you will get to see a wide variety of other’s solutions. I’m looking to pick up more direct methods of getting things done, but you will also find examples of magic like Giacomo and Maciej are talking about.
Yep, reading other people’s code to me was always the best reward
And absolutely don’t be scared about the “competitive” part: I myself like to compete with a very specific challenger.
Myself. And that approach proved to bring me lots of knowledge, practice, fun and, why not, also being among smart people, so, hey, pardon me if I recommend you to try the same
Would you be interested if I created some other challenge in, say, a week? And, in case, what would you suggest me to create a kata around?
[Again many thanks to Albion for bringing me back with this idea ]
@cloudninja, when I get something like this, is it not showing me the test case that I failed because it is so easy that I have to figure out what it is myself?
Done!!!
Simple enough(solved it python,JavaScript) . Although I am curious about the lambda solution @cloudninja used. Was that solution in python? I also solved it another way using map() and lambda was that where you used lambda’s
@factoradic what is your way of calculating average?(is it a technique that is language specific?)
@albionsrefuge, consider that most authors won’t tell you a thing about what is the input you are testing against, as it is in the old competitive coding tradition (you get to code “blindly” to solve a given problem); on CW you can still put a print/puts/console.log statement to know what you are doing and start debugging like crazy!
@rydan, bravo! Not sure about which lambda you are talking about, but I use them in JS, Python and Ruby very frequently. If you want to ask me about a specific piece of code, just link my solution here, so that only people that solved it already can read it (no spoilers !)
Solved this but it did not like my original list comprehension I modified it a tad and it worked. It was solving it correctly but the 2.7.* they use for python has not received the 3.* optimizations to list comprehension so it was taking longer than the 6k ms it has as the limit.