From 88c5cdc315f804127bbdff193803be68c599ea64 Mon Sep 17 00:00:00 2001 From: Guillaume Martres <smarter@ubuntu.com> Date: Wed, 18 Sep 2019 19:53:59 +0200 Subject: [PATCH] 03-homework1.md: Use Scala syntax highlighting --- week1/03-homework1.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/week1/03-homework1.md b/week1/03-homework1.md index 24e70f2..b401438 100644 --- a/week1/03-homework1.md +++ b/week1/03-homework1.md @@ -35,7 +35,9 @@ Do this exercise by implementing the `pascal` function in `0` and returns the number at that spot in the triangle. For example, `pascal(0,2)=1`, `pascal(1,2)=2` and `pascal(1,3)=3`. - def pascal(c: Int, r: Int): Int +```scala +def pascal(c: Int, r: Int): Int +``` # Exercise 2: Parentheses Balancing @@ -59,7 +61,9 @@ contains the same number of opening and closing parentheses. Do this exercise by implementing the `balance` function in `Main.scala`. Its signature is as follows: - def balance(chars: List[Char]): Boolean +```scala +def balance(chars: List[Char]): Boolean +``` There are three methods on `List[Char]` that are useful for this exercise: @@ -85,7 +89,9 @@ Do this exercise by implementing the `countChange` function in `Main.scala`. This function takes an amount to change, and a list of unique denominations for the coins. Its signature is as follows: - def countChange(money: Int, coins: List[Int]): Int +```scala +def countChange(money: Int, coins: List[Int]): Int +``` Once again, you can make use of functions `isEmpty`, `head` and `tail` on the list of integers `coins`. -- GitLab