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.
The urge to write a cheeky one liner is too strong!
*make it
Oh yes haha most of my codewars solutions would not male it to my professional codebases haha
Although this is my solution I'd hate to have this in a real codebase because of readability.
but it can't work 5 elements array or Not %3 length
god damnt! The best solution! :)
The formula used is (if pizzas are circular):
But It leads, when ceiled to 0.01, to many, many ties!!
The calculation is stated quite precisely: price per square inch, rounded upwards to the nearest cent. With such rounding, the cost comparison will result in more ties, and the final result will be based on diameter alone. I believe this is why your fork fails.
(Different orders of operations might still lead to inconsistent answers, but this should be vanishingly unlikely, especially given the transcendental nature of pi.)
There're different ways to calculate the ratio for comparing price-per-squared-inch values (e.g. this) but they don't work here since regardless of the approach there will be inaccuracies from floating point computations which will mess up the order of the elements, and no rounding will be able to fix this. Either the description should provide an exact formula to be used or all the inputs should be integers to enforce using the solution linked earlier.
The description is not clear at all, there's probably a trick to it but the 6kyu label doesn't warrant the time needed to complete.
Niceeee
You can go the mathematical way or you can go the language way.
Really satisfying when these brain teasers allow you to learn something about the language, rather than scrolling wiki pages about math problems to get to your solutions :D
Man I had the same opinion until I reached a certain level of seniority at my job. The thing is, no, you're probably not going to ever use this amount of math if you're (for example a web developer), but these sort of brain teasers keep you sharp, and knowing some math and computer science will go a long way when you need to impress senior devs when interviewing for a job or project. It shows a level of commitment to the craft not many devs have... My two cents... :)
And yes, I do get frustrated with math heavy katas as well hahah
I suppose your right :) Thanks for the tips!
It gets retired when 4 or more ppl downvoted it. Maybe you should read this when authoring katas next time, this one lacks novwelty to be honest as there's many katas like this in the DB that requires similar operations~~ :)
Loading more items...