Skip to content

Instantly share code, notes, and snippets.

@matoous
Last active June 6, 2018 16:49
Show Gist options
  • Save matoous/352ce2065d7f80b93111be13de0f5907 to your computer and use it in GitHub Desktop.
Save matoous/352ce2065d7f80b93111be13de0f5907 to your computer and use it in GitHub Desktop.
#lang scheme
(define (rbp n)
(define (help canBeRed n)
(if (= n 0) 1
(if canBeRed (+ (help #t (- n 1)) (help #f (- n 1)))
(help #t (- n 1)))))
(help #t n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment