Problem 1: Count Change III (100 pts)
Write a procedure make-change
, which takes in positive integers total
and biggest
and outputs a list of lists, in which each inner list contains positive numbers no larger than biggest
that sum to total
.
Note: Both outer list and inner lists should be descending ordered.
Hint: You may find Scheme built-in procedure append
useful.
(define (make-change total biggest)
'YOUR-CODE-HERE
)
;;; Tests
; scm> (make-change 2 2)
; ((2) (1 1))
; scm> (make-change 3 3)
; ((3) (2 1) (1 1 1))
; scm> (make-change 4 3)
; ((3 1) (2 2) (2 1 1) (1 1 1 1))