Tap here to switch tabs
Problem
Submissions

Problem: Find the Array Concatenation Value

med
30 min
Try to solve the Find the Array Concatenation Value problem.

Statement

You are given an integer array nums.

The concatenation of two numbers is the integer obtained by joining their digits together. For instance, the concatenation of 1515 and 4949 is 15491549.

The array concatenation value is initially 00. Execute the following process until nums becomes empty:

  • If there are at least 22 elements in nums, pick the first element and the last element, concatenate their values, add the resulting number to the array concatenation value, and remove both elements from nums.

  • If there is only 11 element remaining in nums, add its value to the array concatenation value and remove it from nums.

Return the final concatenation value of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Array Concatenation Value

med
30 min
Try to solve the Find the Array Concatenation Value problem.

Statement

You are given an integer array nums.

The concatenation of two numbers is the integer obtained by joining their digits together. For instance, the concatenation of 1515 and 4949 is 15491549.

The array concatenation value is initially 00. Execute the following process until nums becomes empty:

  • If there are at least 22 elements in nums, pick the first element and the last element, concatenate their values, add the resulting number to the array concatenation value, and remove both elements from nums.

  • If there is only 11 element remaining in nums, add its value to the array concatenation value and remove it from nums.

Return the final concatenation value of nums.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤104\leq 10^4