Subarray Element Counter Medium

+100 PTS

Before you start the test, check out our tutorial challenge

  • TYPE CODE PRACTICE CHALLENGE
  • LANGUAGES JAVASCRIPT, PHP, PYTHON, PYTHON2 AND 2 MORE
    LANGUAGES JAVASCRIPT, PHP, PYTHON, PYTHON2, RUBY, TYPESCRIPT
  • TIME ~25MIN

Subarray Element Counter

Challenge outline

Hello and welcome to the challenge!


Write a code which counts all elements in the given array and its subarrays (counting subarrays too).


Example


app.count([1,2,[3,4]]) -> 5 (four numbers and one subarray)

Input

  • multi-level array

Output

  • amount of items - integer number N

Constraints

  • 0 < N < 2000


You can solve this programming contest in Ruby, JavaScript, Python and many other languages. If you want, you can also take part in other October 2019 competitions. Below you can find some of them:



Have fun and good luck! :)