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.
good for you man, im still timing out from using the backtracking approach :(
EDIT: I'm sorry, i used some code on github for the solution. Before anyone says anything, I probably shouldn't have done that, however I have spent some time reading the code, and I can fully understand it now. I think the point of codewars is to learn, but sometimes give up if it is too difficult. And for the reason why I did that, well, it's late now, so I got frustrated and just copy pasted some code off the internet.
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.
Yes. I find this much clearer and easier to understand.
Maybe also change the beginning of the first sentence of the Task description in:
Find all integers
k
betweenm
andn
...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
Here are my notes about making it more clear
A "command" 0<=cmd<=UINT_MAX is obfuscatedly associated with one of 5 functions f_A(x)
where 'A' (the "action") is the function's label and takes the values 0<=A<=4
After training you should be able to undo the obfuscation
to determine which action (which function f_A) is referred to by cmd
The function get_action(action)(x) evaluates the function f_action(x).
In order to determine if you have the correct function picked out,
you have to guess an action 'a', calculate sample outputs y=f_a(x) using command(cmd, x),
and using response(y==Y) you can update your guess of 'a' depending on whether or not
the output y corresponds with the true output Y=f_A(x) for all inputs x
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.
I don't think so.
Just like you I would have to understand it from scratch. ('coz I don't remember it at all)
So, please, try to do it yourself!
Feel free to message me back if problems occurred
Good luck =)
Loading more items...