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.
marking issue as resolved, as both katas you refer as duplicates are retired now. If there are any other duplicates, please raise a new issue.
Yes.
toSorted
was added in some newer version of Node, and unfortunately is not available on Codewars.TypeError: arr.toSorted is not a function ??????????
you gotta be joking
mistake improves us
it aasked you to convert not replace. you have to convert it to an integer or float. float is the best solution as it support decimal.
i dont know why everyone is convering it into integr. i mean if the user have given a number with decimals. then! thats why i prefer float whenevr there is a number in a program
Thanks sorry about that, a little new to actually using the site
Please don't post solutions in Discourse, there is a Solutions section to discuss about them.
This comment is hidden because it contains spoiler information about the solution
Your logic is wrong.
You are checking on
x
instead ofn
. Therefore,x
would eventually become zero. You also did not consider cases for powers beyond 3.OP solved it, closing
Python tests go up to 65535, in which doing exponentation on every possible number yields
4294836225
iterations. Imagine doing such costly computation for 100 tests or so...Optimization is required. You can find a mathematical threshold to stop looping, or find common properties of numbers possessing perfect powers ! ^^
You did not identify what distinguishes between a perfect power and a non-perfect-power. Some examples include 8 (2^3), 125 (5^3), 216 (6^3), which are excluded from consideration based on your solution!
0.09 is a random value to estimate the maximum range to check upon, i.e, no mathematical reasoning behind it.
Also, your code would check all number of
(2^53-1) * 0.09
which is equivalent to8.10647932927E+14
down to 0 and doing exponentation on such Big Integers would inevitably cause overflow, if not execution time out.You should find a mathematical threshold to stop looping (early exit) or just research on some properties of perfect powers. ^^
Loading more items...