Sum of Concatenated Pairs in an Array
IntuitionApproachInitialize two pointers:i at the start (0)j at the end (len(nums) - 1)Maintain a variable concat to store the sum of concatenated numbers.Use a
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->The problem requires forming numbers by concatenating the first and last elements of the array and summing them. If the array has an odd length, the middle element is added separately. The two-pointer approach is a natural way to solve this, as it allows efficient pairing of elements.

# Approach
Initialize two pointers:

i at the start (0)

j at the end (len(nums) - 1)

Maintain a variable concat to store the sum of concatenated numbers.

Use a while loop to process pairs (nums[i] and nums[j]):

Convert both numbers to strings and concatenate them.

Convert the concatenated string back to an integer and add it to concat.

Move the left pointer i forward and the right pointer j backward.

If there is a single unpaired middle element (for odd-length arrays), add it separately.

Return concat.



# Complexity
- Time complexity:
O(n)

- Space complexity:
O(1)

# Code
```python3 []
class Solution:
    def findTheArrayConcVal(self, nums: List[int]) -> int:
        if(len(nums)==1):
            return nums[0]
        i=0
        j=len(nums)-1
        concat=0
        while(i<j):
            concat+=int(str(nums[i])+str(nums[j]))
            i+=1
            j-=1
        if i == j:
            concat += nums[i]
        return concat
```
['Python3']