Java || Two Pointers || CF
ApproachWe use a two-pointer technique (with pointers l and r) to compute the concatenation value of an array efficientlyInitialization:The left pointer (l) is
# Approach

**We use a two-pointer technique (with pointers l and r) to compute the concatenation value of an array efficiently**

## Initialization:

The left pointer (l) is initialized to the start of the array (0), and the right pointer (r) is initialized to the end of the array (nums.length - 1)

A variable con is initialized to 0 to store the cumulative concatenation value

## Two-Pointer Traversal:

The pointers l and r move toward each other while processing elements at both ends of the array

- If the two pointers meet (l == r), it means there is a single middle element remaining in the array.

1. Add the value directly to con
2. Break out of the loop, as all elements have been processed


- If the two pointers do not meet:

1. Convert the values at nums[l] and nums[r] into strings
2. Concatenate the two string values (nums[l] + nums[r])
3. Convert the concatenated string back to an integer and add it to con


After processing a pair of elements, increment the left pointer (l++) and decrement the right pointer (r--)



# Code
```java []
class Solution {
    public long findTheArrayConcVal(int[] nums) {
        int l = 0; 
        int r = nums.length - 1; 
        long con = 0; 
        String temp="";
        
        while (l <= r) {
            if (l == r) {
                temp=String.valueOf(nums[l]);
            }
            else{
                temp = String.valueOf(nums[l]) + String.valueOf(nums[r]);
            }
            
            con += Integer.parseInt(temp);
            

            l++;
            r--;
        }
        return con;
    }
}

```
['Java']