Finds all palindromes in a matrix in linear time