Reshape a 1D list into a 2D grid with row-major order.
Constraints
Example
```python # Example 1 arr = [1, 2, 3, 4, 5, 6] reshape_array(arr, 2, 3) # [[1, 2, 3], [4, 5, 6]] # Example 2: invalid dimensions reshape_array([1, 2, 3], 2, 2) # ValueError: Invalid dimensions # Example 3: zero dimension reshape_array([], 1, 0) # [] ```
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints