Skip to content

Commit 5a32261

Browse files
committed
求数组中的最大值
1 parent 03596f6 commit 5a32261

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

common.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
算法复杂度为[O(2n)](http://stackoverflow.com/questions/360748/computational-complexity-of-fibonacci-sequence/360773#360773)
55

66
```js
7-
function fibonacci(n){
7+
function fibonacci(n) {
88
return n < 2 ? n : fibonacci(n-1) + fibonacci(n-2);
99
}
1010
```
11+
12+
### 2.求数组中的最大值
13+
14+
```js
15+
function maxInArray(arr) {
16+
return Math.max.apply(Math, arr);
17+
}
18+
```

0 commit comments

Comments
 (0)