Skip to content

Commit

Permalink
Update 24.answer.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
aoki committed Mar 25, 2015
1 parent 264a0f5 commit abebb3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions answerkey/datastructures/24.answer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def startsWith[A](l: List[A], prefix: List[A]): Boolean = (l,prefix) match {
@annotation.tailrec
def hasSubsequence[A](sup: List[A], sub: List[A]): Boolean = sup match {
case Nil => sub == Nil
case _ => startsWith(sup, sub)
case Cons(h,t) => hasSubsequence(t, sub)
case _ if startsWith(sup, sub) => true
case Cons(_,t) => hasSubsequence(t, sub)
}

0 comments on commit abebb3b

Please sign in to comment.