Skip to content

Commit

Permalink
feat: add towel sort solution
Browse files Browse the repository at this point in the history
  • Loading branch information
pam-param committed Oct 15, 2020
1 parent 8aca090 commit 9ebcbea
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
module.exports = function towelSort (matrix = []) {
let result = [];

// You should implement your task here.

module.exports = function towelSort (matrix) {
return [];
for (let i = 0; i < matrix.length; i++) {
if (i % 2 === 0) {
result.push(...matrix[i]);
} else {
result.push(...matrix[i].reverse());
}
}

return result;
}

0 comments on commit 9ebcbea

Please sign in to comment.