#C1728. Find the Missing Element
Find the Missing Element
Find the Missing Element
You are given two lists of integers. The first list, arr
, represents the complete set of elements, while the second list, brr
, contains all but one of these elements. Your task is to find the missing element by subtracting the sum of brr
from the sum of arr
.
In other words, if \( S_{arr} \) is the sum of the complete list and \( S_{brr} \) is the sum of the incomplete list, then the missing element is given by:
[ \text{missing} = S_{arr} - S_{brr} ]
It is guaranteed that exactly one element is missing and each list has at least two integers.
inputFormat
The input is given in three lines:
- An integer \( n \) representing the number of elements in the complete list
arr
. - \( n \) space-separated integers representing the complete list
arr
. - \( n-1 \) space-separated integers representing the list
brr
with one element missing.
outputFormat
Output a single integer, which is the missing element from the list brr
.
4
1 2 3 4
1 2 4
3
</p>