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.

  • Default User Avatar

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

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

  • 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

    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 =)

  • Custom User Avatar

    Number of 1s in expected answer and n are not same

    No, there're 9 non-zero bits both in n and expected. Not an issue.

  • Default User Avatar

    Thank you so much! I was getting errors about that and did not understand the criteria that was being followed

  • Default User Avatar

    Thanks a lot man! You saved me a lot of headaches. I thought I'm the only who thinks that the instruction lacks crucial details.

  • Default User Avatar

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