Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def countChange_sort(money: Int, coins: List[Int]): Int =
- if (coins.isEmpty || money < 0)
- 0
- else if (coins.tail.isEmpty && money % coins.head != 0) {
- 0
- } else if (coins.tail.isEmpty && money % coins.head == 0 || money == 0) {
- 1
- } else {
- -- redacted --
- }
- }
- } else {
- var cnt = 0
- var i = 0
- def loop(????) : ??? = {
- if (money - (i * coins.head) > 0) {
- cnt += countChange_sort(money - (i * coins.head), coins.tail)
- i = i + 1
- loop(????)
- }
- }
- loop(????)
- cnt
- }
- } else {
- var cnt = 0
- var i = 0
- def loop(cnt : Int, i : Int) : ??? = {
- if (money - (i * coins.head) > 0) {
- cnt += countChange_sort(money - (i * coins.head), coins.tail)
- i = i + 1
- loop(cnt, i)
- }
- }
- loop(cnt, i)
- cnt
- }
- } else {
- var cnt = 0
- var i = 0
- def loop(cnt : Int, i : Int) : Int = {
- if (money - (i * coins.head) > 0) {
- cnt += countChange_sort(money - (i * coins.head), coins.tail)
- i = i + 1
- loop(cnt, i)
- } else {
- cnt
- }
- }
- cnt = loop(cnt, i)
- cnt
- }
- } else {
- var cnt = 0
- var i = 0
- def loop(cnt : Int, i : Int) : Int = {
- if (money - (i * coins.head) > 0) {
- loop(cnt + countChange_sort(money - (i * coins.head), coins.tail), i + 1)
- } else {
- cnt
- }
- }
- cnt = loop(cnt, i)
- cnt
- }
- } else {
- def loop(cnt : Int, i : Int) : Int = {
- if (money - (i * coins.head) > 0) {
- loop(cnt + countChange_sort(money - (i * coins.head), coins.tail), i + 1)
- } else {
- cnt
- }
- }
- loop(0, 0)
- }
Add Comment
Please, Sign In to add comment