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.
This was a very challenging and fun kata! It required a lot of thought about which data structure and which algorithm to use to minimize the number of computations. In the end it was worth it and I managed to pass it marginally.
This comment is hidden because it contains spoiler information about the solution
or maybe the shunting yard algorithm.
This comment is hidden because it contains spoiler information about the solution
Function must return (n+1)-th element.
u(0)
: 1st term of sequenceu(1)
: 2nd term of sequence...
u(n)
: n+1 th term of sequenceThis comment is hidden because it contains spoiler information about the solution
For this case, you don't always end up with 5 nodes in the end.
Here's an counterexample to your case :
E -> B -> G -> __(4)
That's why you overcounted.
A better way to put it would be :
The subarrays (or tuples or Pairs) will have two elements:
k
wheresum_of_squared_divisors(k)
is a perfect square.sum_of_squared_divisors(k)
.This comment is hidden because it contains spoiler information about the solution
Nice! I also made one with Desmos, except my rectangle is rotated 45 deg anti-clockwise when a>b.
https://www.desmos.com/calculator/1okszw7mbp
I already solved the problem by myself and then I stumbled upon your solution which I couldn't understand. No worries if you don't remember the problem. Thanks anyways.
Can you please explain your solution?
my bad I can't count :p
Wrong tests.
For n = 1022 (0011 1111 1110)
Expected: equal to 1279 (0100 1111 1111)
Number of 1s in expected answer and n are not same so clearly expected answer is wrong.
Actual : 1534 (0101 1111 1110) = correct answer
Another wrong test :
For n = 900540478
Expected: equal to 900540495
Actual: 900540510
For those encountering runtime errors on Attempt, don't forget the last sentence of the description : "n being the length of the string array, if n = 0 or k > n or k <= 0 return "" (return Nothing in Elm)."
Loading more items...