Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

MattK

MattK MattK

Niner since 2004

Student of Pure Mathematics and Combinatorics & Optimization at the University of Waterloo
  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    Unfortunately, you can't use a regular expression to check for every palindrome. This is because the "language of palindromes" isn't a regular language.

    You should be able to read more about this in a textbook that covers formal language theory. This includes a lot of textbooks which cover parsing and compilation.
  • Gary Daniels and Evan Goldring - Mock whiteboard problem

    I feel that functional languages haven't been well represented. This is Scheme code:

    (define (palindrome? s)
      (define (iter s)
        (cond ((equal? (length s) 0) #t)
              ((equal? (length s) 1) #t)
              ((equal? (car s) (car (reverse s)))
               (iter (reverse (cdr (reverse (cdr s))))))
              (else #f)))
      (iter (string->list s)))

    Feel the elegance =)