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.
FYI, my
$O(n\log p)$
solution passes in 6 to 9 seconds.Multiplication and division of large integers is not
$O(1)$
so your solution is not really linear. :)In random test,
p
is not always a prime number.Right now I can't see that comment. ;)
I'll submit my code tomorrow after tidying it up. o_O
Seems ok now. :)
Yes, there are indeed three scenarios here, but I don't think they are equal probabilities.
The sample space
S
for picking two marbles from two red and two blue marbles is as follows:Discard
red - red
scenario{(r0, r1), (r1, r0)}
fromS
gives a new sample spaceS'
.Then
P(blue - blue | At least one marble is blue)
=|{(b0, b1), (b1, b0)}| / |S'|
=2 / (12 - 2)
=1 / 5
.What do you think? 🤔
When
urn1
={ "red":1, "blue":1 }
,urn2
={ "red":1, "blue":1 }
,color
="red"
, my brute-force enumeration gives1/5
while the expected answer is1/3
.Could you explain how you get that result? 🤔
At least in the
Sample Tests
, all values in thesubmissions.journal_id
areNULL
.(Btw, IMO the
submissions.translation_id
column and thesubmissions.user_id
column are redundant).This comment is hidden because it contains spoiler information about the solution
Yep.
Some thoughts to improve random tests:
Generate balanceable test cases proportionally to unbalanceable ones.
Generate balanceable test cases proportionally based on the properties of
n
andk
.For example, the number of distinct prime factors of
n
and whetherk
can be represented by two distinct prime factors ofn
.Now I'm curious how you did that. 🤔
⬇
⬇
Long story short, it's a problem with the ruby test library from codewars (the
run_sql
function incorrectly truncates the literal string in some cases).I can take a look at it if you post your code. :)
The regular polygon requirement seems more restrictive than the original conjecture.
I have the following examples of my brute-force program that can not find a configuration that satisfies the regular polygon requirement.
Could you verify them?
Loading more items...