Print Pattern
Difficulty: Easy
Acceptance: %
Points: 20.00
The task is to print a sequence of numbers starting from n, without using a loop. In the sequence, subtract 5 from n repeatedly (i.e., n, n-5, n-10, etc.) until n becomes less than or equal to 0. Once n reaches this condition, start adding 5 back to n (i.e., n+5, n+10, etc.) until n returns to its initial value. Implement a function pattern(n) that takes n as input and returns a list of the generated sequence.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)