May 2018
Intermediate to advanced
328 pages
8h 15m
English
The simplest solution to this problem is to try a brute-force approach, checking if each substring is a palindrome. However, this means we need to check C(N, 2) substrings (where N is the number of characters in the string), and the time complexity would be
. The complexity could be reduced to
by storing results of sub problems. To do so we need a table of Boolean values, of size
, where the element at [i, j] ...
Read now
Unlock full access