Created
August 26, 2015 21:56
-
-
Save OleTraveler/888325c6a9174cfaa78a to your computer and use it in GitHub Desktop.
Interview Question
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
/** Determine if the list l contains a sequence which follows the recurrence relation for the function f. | |
* | |
* A recurrence relation is where numbers in the list determine the rest of the list, for example the Fibonacci sequence | |
* is defined for function plus and you could call this function with the parameters l = List(0,1,1,2,3,5,8,13), f = _ + + | |
* | |
* See InterviewSpec for a test example. | |
* */ | |
def isRecurrenceRelation(l: List[Int], f: (Int, Int) => Int) : Boolean = ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment