This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def sentenceAnagrams(sentence: Sentence): List[Sentence] = { | |
| def subSentence(occ: Occurrences): List[Sentence] = { | |
| if (occ.isEmpty) List(List()) | |
| else | |
| for { | |
| x <- combinations(occ) | |
| y <- dictionaryByOccurrences(x) | |
| z <- subSentence(subtract(occ, x)) | |
| } yield y :: z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package forcomp | |
| import common._ | |
| object Anagrams { | |
| type Word = String | |
| type Sentence = List[Word] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def countChange(money: Int, coins: List[Int]): Int = | |
| if (money < 0 || coins.isEmpty) | |
| 0 | |
| else if (money == 0) | |
| 1 | |
| else | |
| countChange(money - coins.head, coins) + countChange(money, coins.tail) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node_modules/ |
NewerOlder