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.
I agree.
Here's a link I found useful-
https://brilliant.org/wiki/integral-approximation-simpsons-rule/#
ahahaha fr
I think it would even be approved 8, nowadays... XD
In JS, you may want to use BigInt for intermediate calculations. Also, calculating big powers knowing the result should be a mod by can be very expensive.
yes, there is a more efficient algorithm. you should not be picking numbers randomly.
Wrong. There should be no randomness involved in your algorithm. Otherwise, you're right: you may need more than 10 guesses.
After the first guess, why do you need to pick a random number? Why did you pick 500 initially?
your method is not efficient, how would you solve the problem in real life ? your
getRandomArbitrary()
function is problematic, you should have a rationalised algorithm that doesnt involve chance.also, side node: JavaScript is not Python. everytime you write stuff like
variable = 1000
without a prior declaration ofvariable
withlet
,const
orvar
, you are not creating a local variable, you are creating global variables that will stay in memory for the entire duration of the program. it's considered very bad practice and can be the source of many bugs, as global variables will keep their values between function calls. (disregard this if you are doing it intentionally ^^)the formula is right there in the question.
This comment is hidden because it contains spoiler information about the solution
I've typed out in Python (so basically, pseudocode if you don't use Python) the "translation" of the given mathematical formula:
note that in Python the upper limit of the
range()
is not inclusive, so in your language you might need to write from0 -> n
or0 -> n+1
accordingly.You can implement this in your language to see that the numbers are correct, but obviously it won't work for large
n
- hence why the kata has tests withn = 10**6
;)edit-spoilered now that user has read comment
The biggest factor in assessing the rank is the average ranking vote of beta testers. If more people would participate, more votes would be taken into account.
I agree. This is more challenging than the average 7ku. I think it should be a 6. I've noticed what appears to be an overly reductive trend in rankings, where a kata's rank is calculated using something like
Math.max(...subproblemRank)
. This fails to take into account the number of subproblems, the volume of code required, the relative amount of time spent on the problem, and the interactions between subproblems that adds an additional layer of challenge.The last 7kyu I solved asked me to find the shortest word in a sentence. This seems significantly more difficult.
This comment is hidden because it contains spoiler information about the solution
ok
Loading more items...