Last active
August 29, 2015 14:11
-
-
Save e-jigsaw/665f8ff0ff07a4c986a7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| rank = (str, num)-> | |
| ary = str.split '' | |
| target = ary[num] | |
| ary.slice(num+1).reduce (sum, i)-> | |
| if i > target then sum + 1 else sum | |
| , 0 | |
| ans = rank "generating", 0 | |
| console.log ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment