java 1 ms
Consider 12 and 123 as pair, for this pair we first find the length of the second num 123 as 3. Math.pow(10, 3) => gives 1000.\nWe multiply this 1000 with the f
Consider 12 and 123 as pair, for this pair we first find the length of the second num 123 as 3. Math.pow(10, 3) => gives 1000.\nWe multiply this 1000 with the first num 12 and get 12000 and as last step we add second num to this, giving 12123. We apply this logic in loop.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\n$O(1)\n\n# Code\n```\nclass Solution {\n    public long findTheArrayConcVal(int[] nums) {\n        int n = nums.length;\n        if (n == 1) return nums[0];\n        long result = 0;\n        int l = 0;\n        int r = n - 1;\n        while (l < r) {\n            int lenRight = lengthOfNumber(nums[r]);\n            result += (long) Math.pow(10, lenRight) * nums[l++] + nums[r--];\n        }\n        if (l == r) {\n            result += nums[l];\n        }\n        return result;\n    }\n\n    private int lengthOfNumber(int num) {\n        int l = 0;\n\n        while (num != 0)\n        {\n            num /= 10;\n            l++;\n        }\n\n        return l;\n    }\n}\n```
['Java']