ajayg415 / Javascript-Algorithms

1 stars 0 forks source link

Problem: Create NxN matrix from an array input #8

Closed ajayg415 closed 4 years ago

ajayg415 commented 4 years ago

Problem: Create NxN matrix from an array input

Problem 1: Input: [1], Output: [1] Problem 2: Input: [1, 2], Output: [[1, 2], [0, 0]] Problem 3: Input: [1, 2, 3], Output: [[1, 2], [3, 0]] Problem 4: Input: [1, 2, 3, 4, 5], Output: [[1, 2, 3], [4, 5, 0], [0, 0, 0]]

const getMatrix = arr => {
  //code goes here
}