All Problems

Problem title

Difficulty

Avg time to solve

Minimum Path Sum

Moderate

15 mins

Find Duplicates In Array

Easy

15 mins

Palindromic Substrings

Moderate

20 mins

Find All Triplets With Zero Sum

Moderate

30 mins

Size of Largest BST in Binary Tree

Easy

10 mins

Redundant Brackets

Easy

15 mins

Minimize The Difference

Easy

20 mins

Check Bipartite Graph

Moderate

50 mins

Minimum Cost To Make String Valid

Moderate

20 mins

N Stacks In An Array

Hard

20 mins

Problem

Submissions

41

Avg. time to solve

20 min

Success Rate

80%

Problem Statement

```
If the input string is "abbc", then all the possible palindromic substrings would be: ["a", "b", "b", c", "bb"] and hence, the output will be 5 since we have 5 substrings in total which form a palindrome.
```

```
A string is said to be a 'Palindrome' if it is read the same forwards and backwards.
For example, “abba” is a palindrome, but “abbc” is not.
A 'Substring' is a contiguous sequence of characters within a string.
For example, "a", "b", "c", "ab", "bc", "abc" are substrings of "abc".
```

```
The first line contains an integer 't' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first and only line of each test case contains the string STR for which you have to count the number of palindromic substrings.
```

```
For each test case, return the total number of palindromic substrings possible.
Output for each test case will be printed in a separate line.
```

```
You are not required to print anything, it has already been taken care of. Just implement the function.
```

```
1 <= t <= 100
0 <= N <= 1000
Where 't' is the number of test cases, 'N' is the length of the given string.
Time Limit: 1 sec.
```

```
1
abc
```

```
3
```

```
All the substrings of the given string are "a", "b", "c", "ab", "bc", "abc".
The plaindromics substrings are "a", "b", "c". So the output will be 3.
```

```
1
aaa
```

```
6
```

Java (SE 1.8)

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Full Screen Mode

Change Theme

Solution submission not allowed

Save Code

Reset Code