My time limit is exceeding in spite of using DP, please help.
#include <iostream>using namespace std;#include <bits/stdc++.h>typedef long long ll;string s;int strn[6100][6100];int palindrome(int start, int end );int main() {int t;cin >> t;while(t--){cin >> s;memset(strn,-1,sizeof(strn));int ans = palindrome(0,s.length()-1);cout << ans << endl;}}
Read more… (12 words)