aboutsummaryrefslogtreecommitdiff
path: root/racket/leetcode/lc-766-toeplitz-matrix.rkt
blob: 5606d2a0a15c0f044c7b977ba331f3cc0d613026 (plain)
1
2
3
4
5
6
7
8
9
#lang racket

(define/contract (is-toeplitz-matrix matrix)
  (-> (listof (listof exact-integer?)) boolean?)
  (cond [(empty? (cdr matrix)) #true]
        [(equal? (drop-right (car matrix) 1)
                 (drop (cadr matrix) 1))
         (is-toeplitz-matrix (cdr matrix))]
        [else #false]))