Skip to content
Onsite

Array to String with Negatives as Zero

EasyP3Coding

Join the elements of arr into one string with no separator, writing 0 in place of every negative number. A non-negative number is written as its decimal digits, so [12, -5, 7] gives "1207".

Example 1

Input
arr = [12,-5,7]
Output
"1207"

Example 2

Input
arr = [1,2,3]
Output
"123"

Example 3

Input
arr = [-1,-2]
Output
"00"

Constraints

  • 1 <= arr.length <= 1000
  • -1000 <= arr[i] <= 1000

Hints

Run checks the 3 visible tests, Submit all 8.