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.
oh my god
because 'true' is '1' you can do this. Clever!
That is a very clever solution.
The math you described is qute complex and it is hard to attest it to the problem.
The number of point on each spiral circle is
N[k] = N[k-1] * 4 + 4
and that is not mathematical progression.Total points in whole box is
(2*k+1)^2
wherek
is the spiral sequentel number starting from 0Your aim is to calculate
(2*(k-1)+1)^2
and thereafter calculate how far the movements pass behind this point.Each side of square we are looking at having size 2*k+1
;)
you literally built a spaceship for solving this kata
Thanks!
Amazing solution, when it's false then result won't count this way ... very nice and clever one.
Haha
bruh!
Леня? о_О
Love it. Just picking up C++ but very satisfying to see (what I feel is) some exemplary code on an 8kyu!!
Согласен)
result.reserve(numbers.size()); после создания добавить
Можно оптимизировать, создав "result" сразу размера "numbers.size()", чтобы не выполнялись лишние медленные перевыделения памяти.
(It can be optimized by creating "result" with exact size "numbers.size()" - this prevents slow memory reallocations.)