Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS-210 Functional Programming 2019
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taha Zakariya
CS-210 Functional Programming 2019
Commits
88c5cdc3
Commit
88c5cdc3
authored
5 years ago
by
Guillaume Martres
Browse files
Options
Downloads
Patches
Plain Diff
03-homework1.md: Use Scala syntax highlighting
parent
60d7476b
No related branches found
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
week1/03-homework1.md
+9
-3
9 additions, 3 deletions
week1/03-homework1.md
with
9 additions
and
3 deletions
week1/03-homework1.md
+
9
−
3
View file @
88c5cdc3
...
...
@@ -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`
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment