What is the time complexity of the brute force algorithm used to find the length of the longest palindromic subsequence?
O(1)
O(2^{n})
O(n)
O(n^{2})
Answer and explanation
In the brute force algorithm, all the subsequences are found and the length of the longest palindromic subsequence is calculated. This takes exponential time.
