parent
2656dd3f58
commit
4b93959c4f
@ -0,0 +1,17 @@
|
||||
# Morning Exercise
|
||||
|
||||
With these morning exercises, we want you to think about how to, not only tackle the problem, but to see how effeciently you can solve them. Solve this one in **two** different ways.
|
||||
|
||||
## The Biggest Difference
|
||||
|
||||
Write a function that takes in the array and returns the **largest difference** between any **two** of its elements. You can assume that the array is all numbers and that there are no duplicates.
|
||||
|
||||
The starter code:
|
||||
``` javascript
|
||||
var biggestDifference = function(arr){
|
||||
// code goes here...
|
||||
}
|
||||
|
||||
biggestDifference([1,4,7,3,2]) // would return 6
|
||||
biggestDifference([9, 20, 5, -6, -1, 8]) // would return 26
|
||||
```
|
||||
Loading…
Reference in new issue