7 kyu

The real size of a multi-dimensional array

Description:

Challenge:

Given a multi-dimensional integer array, return the total number of integers, stored inside this array. You should not rely on the number of dimensions to solve this kata. If n is the number of dimensions, then: 1 <= n < +Infinity.

Example:

Given [[[5], 3], 0, 2, [], [4, [5, 6]]], your function should return a result of 7. This is because the array contains 7 integers.

Addendum:

Think of it as dimension-agnostic value counting. We want to know the total number of integers inside the array and we don't care for the dimensions.

Arrays
Recursion
Fundamentals

Stats:

CreatedOct 1, 2016
PublishedOct 1, 2016
Warriors Trained1124
Total Skips8
Total Code Submissions2224
Total Times Completed738
JavaScript Completions738
Total Stars21
% of votes with a positive feedback rating92% of 151
Total "Very Satisfied" Votes130
Total "Somewhat Satisfied" Votes17
Total "Not Satisfied" Votes4
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • lilsweetcaligula Avatar
  • user8476848 Avatar
  • trashy_incel Avatar
Ad