Fancy Sequence
Problemβ
Write an API that generates fancy sequences using the , , and operations.
Implement the class:
-
Fancy() Initializes the object with an empty sequence.
-
void append(val) Appends an integer val to the end of the sequence.
-
void addAll(inc) Increments all existing values in the sequence by an integer inc.
-
void multAll(m) Multiplies all existing values in the sequence by an integer m.
-
int getIndex(idx) Gets the current value at index (0-indexed) of the sequence modulo + . If the index is greater or equal than the length of the sequence, return