https://leetcode.com/problems/convert-1d-array-into-2d-array/


Runtime: 2067 ms, faster than 7.32% of TypeScript online submissions for Convert 1D Array Into 2D Array.

Memory Usage: 63.8 MB, less than 92.68% of TypeScript online submissions for Convert 1D Array Into 2D Array.


```typescript
function construct2DArray(original: number[], m: number, n: number): number[][] {
    //9:00
    if (original.length != m * n) {
        return []
    }
    
    let result = []
    let row_index = 0
    while (row_index < m) {
        let temp_row = []
        
        let column_index = 0
        while (column_index < n) {
            temp_row.push(original.shift())
            column_index += 1
        }
        
        result.push([...temp_row])
        row_index += 1
    }
    
    return result
    //9:05
};
```
