Ad
  • Custom User Avatar

    This is 4kyu problem and it supposed to be hard;p

    I saw your solution and it is literally creating all sequence elements all the way upto n which is not intended at all (by time complexity and storage too).

    This problem requires some data structure and algorithm (which is not hard in this problem) and can be solved in few lines (in python atleast).

    I can assure there is no math involved;

    This can;t be solved using recursion because it is an infinite fractal;p