I fully agree.
I have not solved it yet (nor have I given up, though), yet I managed the related kata asking for the last digit of a^b.
Like you I searched extensively on the web for algos such as modular exponentiation, but I doubt this is the expected method.
Yes thank you, I did it with rounding it to just 3 and it passed everything. This tortured me, because even when dedugging, it clearly returned 1 as the sum of probabilities, yet strangely hit false which was driving me crazy as it is actually quite an easy problem. I don't know, it was probably a 1,000.....1 or something like that. But wouldn't the exact number be shown, if it were calculated like this?
After a few hours of trying, I strategically retreated ( gave up) and took a peak at the solutions. My question is, how to generally approach such problems? I looked into all sorts of possible mathematical solutions, like Euler's totient function or Binomial expansion, and I saw that the solutions are very much simpler that those methods, but I still do not understand the reasoning behind the solutions I saw at all,even though they were rather simple programming- wise. Any advice from more experienced solvers would be greatly appreciated!
I have run the tests multiple times, and always get a mistaken result, always with the message that "Good to Drink" should equal the other condition. I cannot understand where the error comes from, since it passes dozens of much larger tests every time.
Aw I found it. I should have used the absolute value of t, my bad. Thank you for assisting me though, I appreciate it. You should create some more demanding Statistics tests, perhaps even barring pre-made libraries from being used, just for the sake of it.
Aw yes, I just woke up and saw it, thank you. It was bothering me.
Now it passes 217 test cases and fails at one:( with a wrong result. How could it pass 217 cases and still get a single wrong result? The algorithm seems correct, I do not understand what the problem is.
Hint : it has something to do with the way you are indexing t_table. Read the description carefully : "You are given a table of critical t values (t_table), containing only positive values of t (the t distribution is symmetrical) which you may access like so : t_table[degrees_of_freedom - 1][probability]."
I fully agree.
I have not solved it yet (nor have I given up, though), yet I managed the related kata asking for the last digit of a^b.
Like you I searched extensively on the web for algos such as modular exponentiation, but I doubt this is the expected method.
Not an issue.
Yes thank you, I did it with rounding it to just 3 and it passed everything. This tortured me, because even when dedugging, it clearly returned 1 as the sum of probabilities, yet strangely hit false which was driving me crazy as it is actually quite an easy problem. I don't know, it was probably a 1,000.....1 or something like that. But wouldn't the exact number be shown, if it were calculated like this?
I have just tested your solution with your sum rounded to 15 decimal places and it passed all test cases.
What is that supposed to mean?
/
Your approach doesn't work for a couple of reasons, the major ones being:
Node
you will get exceptions forenumerate(ls)
andlen(ls)
.return back
because it ends withreturn front
.list
s tofront
andback
but this kata wants linked lists, i.e.Node
objects.front
andback
afterwards.After a few hours of trying, I strategically retreated ( gave up) and took a peak at the solutions. My question is, how to generally approach such problems? I looked into all sorts of possible mathematical solutions, like Euler's totient function or Binomial expansion, and I saw that the solutions are very much simpler that those methods, but I still do not understand the reasoning behind the solutions I saw at all,even though they were rather simple programming- wise. Any advice from more experienced solvers would be greatly appreciated!
-Marking it as Resolved-
I have run the tests multiple times, and always get a mistaken result, always with the message that "Good to Drink" should equal the other condition. I cannot understand where the error comes from, since it passes dozens of much larger tests every time.
Aw I found it. I should have used the absolute value of t, my bad. Thank you for assisting me though, I appreciate it. You should create some more demanding Statistics tests, perhaps even barring pre-made libraries from being used, just for the sake of it.
Hmm. Maybe try running the tests again.
Aw yes, I just woke up and saw it, thank you. It was bothering me.
Now it passes 217 test cases and fails at one:( with a wrong result. How could it pass 217 cases and still get a single wrong result? The algorithm seems correct, I do not understand what the problem is.
Hint : it has something to do with the way you are indexing t_table. Read the description carefully : "You are given a table of critical t values (t_table), containing only positive values of t (the t distribution is symmetrical) which you may access like so : t_table[degrees_of_freedom - 1][probability]."
This comment is hidden because it contains spoiler information about the solution
I'm not a professionnal programmer either, I do it as a hobby. ;)
Loading more items...