#K63687. Disappearing Numbers Process
Disappearing Numbers Process
Disappearing Numbers Process
Given a list of integers, simulate the following process:
- Each day, remove the first number (the "footprint") from the list.
- Subtract this footprint from every remaining number in the list.
- Repeat until the list becomes empty.
Mathematically, if the list on a given day is \(a_1, a_2, \dots, a_k\), then after that day the new list becomes \(a_2 - a_1, a_3 - a_1, \dots, a_k - a_1\). Continue this process until no numbers remain.
Note: For any non-empty list the final result will always be an empty list.
inputFormat
The first line contains an integer (n), the number of integers. The second line contains (n) space-separated integers.
outputFormat
Print the final list after simulating the process. Since all numbers disappear eventually, the output should be an empty list denoted as "[]".## sample
4
5 3 8 10
[]
</p>