7 kyu
Find the smallest power higher than a given a value
1,928 of 4,166raulbc777
Loading description...
Fundamentals
Mathematics
Logic
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
UPDATED JAVA TRANSLATION
ok
Java:
-2118184960
is2176782336
as anint
, it looks correct, but there shouldn't be tests like this in the first place.Let me look into it
This updated Translation should fix it
Second Java Translation because the first one didn't work for some reason
Now it worked. Approved!
Lua translation!
Approved!
Java Translation
I'd like to approve it but I couldn't.
Why couldn't you approve it?
Groovy Translation
It also includes a more language-agnostic description
Approved!
python new test framework
Approved
Thanks for your support +1
Nice kata. And perfectly graded as 7 kyu.
some boring
Please review: C++ Translation
Approved +1
badly desc and test cases
I already had it correctly but sublime text made me lose abput 1 hr calling a syntax error, the i just copied the code from sublime and I ran it here and it worked
This comment has been hidden.
i've tested the reference solution with (
4003730, 2
) and it returns4004001
, so i'm not sure what happened. did you copy/paste this directly from the tests' output ?Yes, I copy pasted it, very strange
Please review and approve, thanks !
Approved +1
.
Forgot to add the language specific block in the description. Here is the fork that adds it.
@Glinator There should be tests with values that are already perfect powers
Yeah I know, but what should happen in this case ? The description does not say clearly "strictly greater" nor "greater than or equal to" so it's somewhat ambiguous, even if the first interpretation is more likely.
Vocabulary aside, the author's original solutions in both Python and JS use
ceil
and I'm pretty sure raulbc777 knows the difference betweenceil(x)
andfloor(x+1)
.So before adding these tests, I'd like to be sure what to do.
But don't get me wrong, I'm willing to add them.
Scala translation
oops alr approved
Approved! +1 Thanks
test: With val = 1 and pow = 3 the answer should be 8: expected undefined to equal 8
1 ** 3 = 1?? why 8. but ok
Because you need to return a cube higher than 1.
This comment has been hidden.
This is spoiling the solution and it is not welcome to post similar things in Discourse. The users are supposed to find the solution by themselves. I marked your message with a spoiler flag.
lol sry, didn't mean it like that, i should edit it
Is it ok already? I can't solve it. All tests are fine except "Already perfect numbers". I am stuck pls help
Which language?
JavaScript
The tests are fine, your code isn't. You've just hardcoded the sample test with 8 and 3 as input.
That because i just wanted to skip everything to see solution. I could send my normal attempt
If it fails all those tests, it means your code is returning a number that's not higher than
val
. It tells you that in the error message.This comment has been hidden.
I'll check it, it seems there is indeed a problem.
Thak you)
Try again, it should be fixed.
It was submited thank you again
This comment has been hidden.
Let's see the first sentence:
value there is 12385 and pow_ is 3, the answer is 13824 that's 243
Does that help?
Hard to judge now as I alrady solved it by the time I updated the comment. Anyways, thanks for the response.
This comment has been hidden.
This is not an issue (= a bug in the kata).
Thanks for the reply. Sorry I am new to all of this!
i tried other peoples solutions and that last test seems to pass which makes me think it's a problem with my code? Or is it definitely a bug in the kata?
This code is not correct. Random tests are incomplete in several languages, that's why your solution can pass them. This is related to the issue opened just below.
This comment has been hidden.
Check the control function doesn't fail those tests, at least javascript one used ceil.
added in C
Ruby 3.0 should be enabled
done
Python new test framework should be used
Initial solution setup should be
return 0
fixed by fork above
Initial solution setup in JS should just
return 0
Parameter in initial solution setup should be
camelCase
Unnecessary logs should be removed
Fork with almost all that fixed: https://www.codewars.com/kumite/62f64c2f2a9bef00525d621b?sel=62f64c2f2a9bef00525d621b
But, I left
pow_
as it is, just to not create a code block in the description and keep the argument's name the same for every language. In javascriptpow
isn't a reserved keyword.BTW: the random tests compared the result of the control function to itself. So this invalid solution worked: https://www.codewars.com/kata/reviews/56bb271b6ee8d209be000054/groups/62f668c5094ade0001c080da
I'll mark it as resolved.
C Translation
Let's see if the precision you selected is enough. Approved +1
Thanks raulbc777, it was approved while I was in the middle of editing it based on feedback from akar-0, but it seems to have taken the final version somehow! Let me know if I need to make any adjustments.
Actually, no. I'll put it in through the editor.
EDIT: all done, looks good
One user has just solved in C. It seems that's ok
Rust random tests:
4826809
is not higher than4826809
.The same for javascript, maybe other languages.
Damned floats :D
Should be fixed in the current version (I used your solution like reference solution since... it's the best). I'll fix my other translations too.
I guess it means most solutions to this kata are actually incorrect? I added perfect powers in random tests.
Well, there may be issues in other languages, but for Rust it's ok...
You did it again!. The trilogy GO - D - RUST for this one, too
Rust translation
Approved! +1
D version Approved, too +1
Go
Approved! +1
The second test case value should be 1234567.
This comment has been hidden.
Thank you, cool kata :)
Thanks for your feedback and time solving this kata.
The word "perfect" has a specific meaning when it comes to numbers that is different from the meaning you are using here. You should change that word.
I erased the word perfect according to your suggestion.
Terrible description, could REALLY use some much clearer explanation. Solution that gives correct answers in interpreter does not pass the test cases.
This comment has been hidden.
This comment has been hidden.
Very good observation! We have to include some cases of course.
Maybe it is the only trap of this kata! :D
It seems it was never done. At least in javascript.
This should be an issue