Array Concatenation Value
Approach\n Describe your approach to solving the problem. \nWe need to iterate on the list from the start and reverse from the end. We will only interate half o
# Approach\n<!-- Describe your approach to solving the problem. -->\nWe need to iterate on the list from the start and reverse from the end. We will only interate half of the loop. Then we will concatinate ```i```th and ```n - i - 1```th element by converting it into string, adding it and again converting it to the integer. We will then add it to our final result. \n\nThis will only go if the total number of elements in the list are even. If the total number of elements are odd then we will add the middle element on our final answer \n\n# Complexity\n- Time complexity: O(n/2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def findTheArrayConcVal(self, nums: list[int]) -> int:\n        ans = 0\n        length = len(nums)\n        if length == 1:\n            return nums[0]\n        \n        for i in range(int(length / 2)):\n            ans += int(str(nums[i]) + str(nums[length - i - 1]))\n        if length % 2 == 1:\n            ans += nums[int(length / 2)]\n        \n        return ans\n```
['Dynamic Programming', 'Python3']