Last active
January 22, 2016 09:45
-
-
Save mhshams/b700aae4987da20fd125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A function that takes TWO arrays of Integer, compares them and then returns: | |
* - 1, if the first array is greater than second one | |
* - -1, if the second array is greater tan first one | |
* - 0, if both arrays are the same. | |
* | |
* How to Compare? | |
* Starting from index 0, compare the elements of both array in the same positions until you find one is bigger than the other. | |
* | |
* Examples: | |
* - [1, 2, 3] is bigger than [1, 2, 0] then: return 1 | |
* - [3, 1] is smallaer than [4] then: return -1 | |
* - [2] is bigger than [1, 2, 3, 4, 16] then: return 1 | |
* - [3, 2, 5] is smaller than [3, 2, 5, 0] then: return -1 | |
* - [3, 1, 5] is equal to [3, 1, 5] then: return 0 | |
* | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment