Ad
  • Custom User Avatar

    I'm going to give you a few general hints, which applies to ALL problem solving challenges like this.
    "Start with the extremes": Instead of starting for a generic N, maybe start with 1.

    If you havent already, try getting out a pen and paper, and workout a few examples, and try and spot a pattern. Also, you are tasked to find the value for f(n), so try to be deliberate on this "intermidiate" value. Keep this in your mind, when looking for patterns.

    Anymore than this, unfortunately will give away too much, and I don’t want to rob you of the satisfaction when you finally solve this!

  • Custom User Avatar

    You are so nice. It tooke me a while to figure out the logic of the task. This is why I've stayed with a loop instead of a one-linear based on 'reduce'.

  • Custom User Avatar

    well spotted, fixed

  • Custom User Avatar

    I can't find these words anywhere in the description. Could you be more specific?

  • Custom User Avatar

    Thanks for informing me, That's certainly not an accurate implementation for passing all possible tests, I applied a different answer considering this problem.