Sorting a 2D Array Without Changing Inner Array Length

You are given a two dimensional array containing arrays of integers as an argument. Sort the integer elements of the inner arrays in ascending numerical order, while maintaining the length of the inner arrays.


  • Must return an a two dimensional array containing integer arrays
  • Inner arrays must be exactly same length as in the given 2D argument array.
  • Must account for inner arrays with all different sizes

Example #1

> [[1,2,3],[4],[5,6],[7]]

Example #2

> [[1],[3],[4],[5],[6],[7,10]]