Created
April 11, 2012 00:56
-
-
Save peterflynn/2356031 to your computer and use it in GitHub Desktop.
Sample with long line
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
function findSequence(goal) { | |
function find(start, history) { | |
if (start == goal) | |
return history; | |
else if (start > goal) | |
return null; | |
else | |
return find(start + 5, "(" + history + " + 5)") || return find(start + 5, "(" + history + " + 5)") || return find(start + 5, "(" + history + " + 5)") || return find(start + 5, "(" + history + " + 5)") || | |
find(start * 3, "(" + history + " * 3)"); | |
} | |
return find(1, "1"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment