Skip to content

Commit c3827db

Browse files
author
Mohan
committed
max,min of array combination
1 parent b261ee0 commit c3827db

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rearrange_array_linear.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
2+
let result = []
3+
4+
for (let i = 0; i < arr.length / 2; i++) {
5+
result.push(arr[arr.length - i - 1])
6+
result.push(arr[i])
7+
}
8+
9+
console.log(result)

0 commit comments

Comments
 (0)