Ad
  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    or maybe the shunting yard algorithm.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The goal is to create a function that returns the n-th element of this sequence.

    Function must return (n+1)-th element.

    u(0) : 1st term of sequence

    u(1) : 2nd term of sequence

    ...

    u(n) : n+1 th term of sequence

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    E -> inner (4) -> outer (4) -> __ (5)

    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.

  • Default User Avatar

    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 between m and n ...

  • Custom User Avatar

    The subarrays (or tuples or Pairs) will have two elements: first the number the squared divisors of which is a square and then the sum of the squared divisors.

    A better way to put it would be :

    The subarrays (or tuples or Pairs) will have two elements:

      1. A number k wheresum_of_squared_divisors(k) is a perfect square.
      1. sum_of_squared_divisors(k).
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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...