Skip to content
Snippets Groups Projects
Commit 88c5cdc3 authored by Guillaume Martres's avatar Guillaume Martres
Browse files

03-homework1.md: Use Scala syntax highlighting

parent 60d7476b
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,9 @@ Do this exercise by implementing the `pascal` function in ...@@ -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, `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`. `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 # Exercise 2: Parentheses Balancing
...@@ -59,7 +61,9 @@ contains the same number of opening and closing parentheses. ...@@ -59,7 +61,9 @@ contains the same number of opening and closing parentheses.
Do this exercise by implementing the `balance` function in Do this exercise by implementing the `balance` function in
`Main.scala`. Its signature is as follows: `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 There are three methods on `List[Char]` that are useful for this
exercise: exercise:
...@@ -85,7 +89,9 @@ Do this exercise by implementing the `countChange` function in ...@@ -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 `Main.scala`. This function takes an amount to change, and a list of
unique denominations for the coins. Its signature is as follows: 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` Once again, you can make use of functions `isEmpty`, `head` and `tail`
on the list of integers `coins`. on the list of integers `coins`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment