Skip to content

Instantly share code, notes, and snippets.

@OleTraveler
Created August 26, 2015 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save OleTraveler/888325c6a9174cfaa78a to your computer and use it in GitHub Desktop.
Save OleTraveler/888325c6a9174cfaa78a to your computer and use it in GitHub Desktop.
Interview Question
/** 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