'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
About
JNTUH College of Engineering Sultanpur 2022
C++ - Default language
My Stats
EXP gained
yellow-spark
44888
Level
7 (Expert)
Community stats
Discussions
2
Upvotes
1
Know more
Weekly contest rating
Contest attended
Problems solved
2021 2024
Better than %
Weekly contest rating
Contest attended
Problems solved
2021 2024
Better than %
540
Total problems solved
310
Easy
156
Moderate
68
Hard
6
Ninja
Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec Jan Jan Feb Feb

Current streak:

6 days

Longest streak:

9 days

Less

More

Achievements
Contest Ranks
4
Achiever
Topics
Greedy
Binary Search
Ad-Hoc
+ 1 more
8
Specialist
Topics
Backtracking
Graph
Trees
+ 5 more
8
Master
Topics
Tries
Recursion
Strings
+ 5 more
1
Specialist
Guided path
Basics of C++
1
Specialist
Special Guided path
Competitive programming
Discussions
Easy C++ Solution || DP
Interview problems

```
#include <bits/stdc++.h> 
int palindromesAtIndex(string s, int ind, int l){
    // Write your code here.
    ind--;
    int n=s.size();
    vector<int> pal(n,0);
    int res=0;
    vector<vector<bool>>  isPal(n,vector<bool>(n,false));
    for (int i = 0; i < n; i++) {
      isPal[i][i] = true;
      if(ind==i && l==1)
            res++;

    }
    for(int i=1;i<n;i++){
      if (s[i] == s[i - 1]) {
            isPal[i - 1][i] = true;
            if(ind==i-1 && 2>=l)
                res++; 
     
      }
    }
    for(int len=3;len<=n;len++)
    {
        for(int j=0;j+len-1<n;j++)
        {
            int k=j+len-1;
            if(s[j]==s[k] && isPal[j+1][k-1])
                isPal[j][k]=true;
            if(isPal[j][k] && len>=l)
                pal[j]++;
        }
    }
     res+=pal[ind];
    return res;
}
```
profile
saiteja_balla
Published On 30-Nov-2023
51 views
0 replies
0 upvotes