
You are given a list of 'N' non-negative transaction IDs. Your task is to perform two operations: a verification check and an audit sum.
The verification is successful only if the common digit condition is true for all adjacent pairs.
The first line of input contains an integer 'N', the number of transaction IDs.
The second line contains 'N' space-separated long integers, representing the transaction IDs.
The first line of output must be either true or false, indicating the result of the verification check.
The second line of output must be a single integer, the total sum of all transaction IDs.
If N <= 1, there are no adjacent pairs to check, so the verification is considered true.
Transaction IDs can be large, so use a data type that can handle 64-bit integers (e.g., long in Java, long long in C++).
3
12 23 34
true
69
- Pair 1: `12` and `23`. They share the digit '2'.
- Pair 2: `23` and `34`. They share the digit '3'.
Since all adjacent pairs have a common digit, the first output is `true`.
The sum is `12 + 23 + 34 = 69`.
1
500
true
500
There is only one transaction ID, so there are no adjacent pairs to check. The condition is vacuously true.
The sum is 500.
The expected time complexity is O(N * log(max_id)), where log(max_id) is the number of digits in the largest transaction ID.
1 <= N <= 10^5
1 <= transaction ID <= 10^10
Time limit: 1 sec