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.
Sure! Without this one, the code is more complicated than expected.
I guess it's your implementation's problem. I faced the same but changed something in data structure and now it works. I'm sure it's because function composition and matrix multiplication are non-commutative so the order of evalutation should be preserved.
I didn't have problems with min though.
For every fixed
k
,c[j]
is exactly the number of partitions ofj
using only numbers from1
tok
after inner cycle. This is possible to prove by induction.a) When
k=1
,c[j]=1
for allj
from0
ton
because the only way to make a partition of any integer with only1
's is simply1+1+...+1
.b) Now suppose it's true for
k-1
and for allj < j'
fork
. To get partitions ofj
with termk
, we need to appendk
to all partitions ofj-k
. Sincec[j-k]
has correct value by induction hypothesis, we get correct value forc[j]
by addingc[j-k]
.Then calculations up to
k=n
givec[n]
as answer.UPD: while writing this, I noticed the comments in the code are about generating function of number of integer partitions. Then I recommend to check https://en.wikipedia.org/wiki/Partition_(number_theory) (part about generating function) and https://en.wikipedia.org/wiki/Generating_function. The algorithm is easy to interpret in terms of operations with generating functions.
Glad to see the Gaussian elimination here!
I guess using Riemann zeta function was a kind of overkill :)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Great kata! I had to remember some interesting sqrt-algorithms to deal with this!
This is modification of digit-by-digit calculation method
This comment is hidden because it contains spoiler information about the solution
Можно оптимизировать, создав "result" сразу размера "numbers.size()", чтобы не выполнялись лишние медленные перевыделения памяти.
(It can be optimized by creating "result" with exact size "numbers.size()" - this prevents slow memory reallocations.)
What if dna.size() > 100?
Yeah, you're right (I don't care it was 3 years ago :) )
Holy cow, that's a massive one!
This comment is hidden because it contains spoiler information about the solution
Loading more items...