Split Array Into Multiple Arrays Typescript Interview