|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
457 bytes
|
| Line | |
|---|
| 1 | function unzip(zipped) {
|
|---|
| 2 | let maxLen = 0;
|
|---|
| 3 | for (let i = 0; i < zipped.length; i++) {
|
|---|
| 4 | if (zipped[i].length > maxLen) {
|
|---|
| 5 | maxLen = zipped[i].length;
|
|---|
| 6 | }
|
|---|
| 7 | }
|
|---|
| 8 | const result = new Array(maxLen);
|
|---|
| 9 | for (let i = 0; i < maxLen; i++) {
|
|---|
| 10 | result[i] = new Array(zipped.length);
|
|---|
| 11 | for (let j = 0; j < zipped.length; j++) {
|
|---|
| 12 | result[i][j] = zipped[j][i];
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 | return result;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | export { unzip };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.