diff --git a/week1/03-homework1.md b/week1/03-homework1.md index 24e70f26e3fd0a0c5b68ae04293ccacbce5d77fb..b401438887e543b19ede6705df951132c7ff6dc7 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`.