Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pitDepth(p: Int, q: Int, r: Int) = (p - q) min (r - q)
- def updateDepths(pqrd: (Int,Int,Int,Int), x: Int): (Int,Int,Int,Int) = pqrd match {
- case (p,q,r,d) if /*conds*/ => /*upslope reset*/
- case (p,q,r,d) if /*conds*/ => /*update q*/
- case (p,q,r,d) if /*conds*/ => /*update r and d*/
- case (p,q,r,d) if /*conds*/ => /*update d and reset*/
- }
- def maxDepth(list: List[Int]): Int = list match {
- case Nil => -1
- case head :: tail => tail.foldLeft((head,Int.MaxValue,Int.MinValue,-1)) ((quad,x)=>updateDepths(quad,x))._4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement