2562. Find the Array Concatenation Value ¶ Time: $O(n)$ Space: $O(1)$ C++ 1 2 3 4 5 6 7 8 9 10 11 12 13 14class Solution { public: long long findTheArrayConcVal(vector<int>& nums) { long ans = 0; for (int i = 0, j = nums.size() - 1; i <= j; ++i, --j) { ans += nums[j]; if (i < j) ans += nums[i] * pow(10, static_cast<int>(log10(nums[j])) + 1); } return ans; } };