Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You are given a palindromic string s of length n . You have to count the number of indices i (1 <= i <= n) such that the string after removing s_i from s still remains a palindrome. For example, consider s = "aba" A palindrome is a string that reads the same backward as forward. For example, "abba", "a", "fef" are palindromes whereas "codeforces", "acd", "xy" are not. The input consists of multiple test cases. The first line of the input contains a single integer t (1 <= q t <= q 10^3) -- the number of test cases. Description of the test cases follows. The first line of each testcase contains a single integer n (2 <= q n <= q 10^5) -- the length of string s . The second line of each test case contains a string s consisting of lowercase English letters. It is guaranteed that s is a palindrome. It is guaranteed that sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the number of indices i (1 <= i <= n) such that the string after removing s_i from s still remains a palindrome. The first test case is described in the statement. In the second test case, the indices i that result in palindrome after removing s_i are 3, 4, 5, 6 . Hence the answer is 4 . In the third test case, removal of any of the indices results in "d" which is a palindrome. Hence the answer is 2 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
158113762 |
ahmedabdelkreim |
A |
May 23, 2022, 5:26 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
7 |
62 |
12595200 |
|
|
158526775 |
allegrogiken |
A |
May 26, 2022, 12:33 p.m. |
OK |
D |
TESTS |
8 |
30 |
4198400 |
|
|
158335588 |
rakib151p |
A |
May 24, 2022, 8:38 p.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158362711 |
kflny |
A |
May 25, 2022, 7:56 a.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158180572 |
chandler970 |
A |
May 23, 2022, 3:06 p.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158304526 |
yibaiyi20 |
A |
May 24, 2022, 1:53 p.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158124797 |
Vega_C47 |
A |
May 23, 2022, 8:12 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
102400 |
|
|
158143339 |
loki_7 |
A |
May 23, 2022, 12:30 p.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158193928 |
Warior77 |
A |
May 23, 2022, 3:27 p.m. |
OK |
GNU C11 |
TESTS |
8 |
15 |
102400 |
|
|
158115053 |
bitch_Stewie |
A |
May 23, 2022, 5:47 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
102400 |
|
|
158123673 |
Rutts07 |
A |
May 23, 2022, 7:53 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
102400 |
|
|
158123874 |
Rutts07 |
A |
May 23, 2022, 7:57 a.m. |
OK |
GNU C11 |
TESTS |
7 |
15 |
102400 |
|
|
158309508 |
zhicheng |
A |
May 24, 2022, 2:48 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
0 |
102400 |
|
|
158132403 |
liyipeng |
A |
May 23, 2022, 10:04 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
102400 |
|
|
158143792 |
liyipeng |
A |
May 23, 2022, 12:36 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
0 |
102400 |
|
|
158129226 |
vijaykumarganji1 |
A |
May 23, 2022, 9:17 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
204800 |
|
|
158137744 |
logh1 |
A |
May 23, 2022, 11:21 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
204800 |
|
|
158132677 |
Sakura_xyz |
A |
May 23, 2022, 10:08 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
204800 |
|
|
158105786 |
RS00 |
A |
May 23, 2022, 2:55 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
0 |
204800 |
|
|
158324432 |
Wilbert1124 |
A |
May 24, 2022, 5:37 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
0 |
307200 |
|
|
158293630 |
mahmoudkhalid112 |
A |
May 24, 2022, 11:47 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
0 |
307200 |
|
|
158276765 |
noobK |
A |
May 24, 2022, 8:06 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
0 |
307200 |
|
|
158122273 |
luowang666 |
A |
May 23, 2022, 7:33 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
102400 |
|
|
158112425 |
_Unbreakable_ |
A |
May 23, 2022, 5:05 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
102400 |
|
|
158125053 |
acwing_meow |
A |
May 23, 2022, 8:16 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
102400 |
|
|
158115562 |
windy7926778 |
A |
May 23, 2022, 5:55 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
204800 |
|
|
158142619 |
GraphC |
A |
May 23, 2022, 12:21 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
0 |
307200 |
|
|
158110518 |
Amigomust |
A |
May 23, 2022, 4:35 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
307200 |
|
|
158124754 |
keerthanareddy123 |
A |
May 23, 2022, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
307200 |
|
|
158128637 |
czauderna |
A |
May 23, 2022, 9:08 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
307200 |
|
|
158136998 |
Providence |
A |
May 23, 2022, 11:11 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
0 |
307200 |
|
|
158579352 |
forPractice1 |
A |
May 27, 2022, 4:34 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
0 |
409600 |
|
|
158270919 |
exzang |
A |
May 24, 2022, 6:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
204800 |
|
|
158484185 |
azhe-no-hand |
A |
May 26, 2022, 2:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158124613 |
sudiptikader704 |
A |
May 23, 2022, 8:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
307200 |
|
|
158139698 |
Kellyz |
A |
May 23, 2022, 11:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158387220 |
abhi096 |
A |
May 25, 2022, 12:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158234857 |
rostoki |
A |
May 23, 2022, 6:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158134821 |
rs_1900 |
A |
May 23, 2022, 10:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
0 |
409600 |
|
|
158359568 |
retiredd |
A |
May 25, 2022, 7:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158288201 |
kadde |
A |
May 24, 2022, 10:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158280207 |
lesjones254 |
A |
May 24, 2022, 8:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
409600 |
|
|
158104251 |
cqtjs |
A |
May 23, 2022, 2:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
7 |
0 |
102400 |
|
|
158264073 |
KalbAsad |
A |
May 24, 2022, 4:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
102400 |
|
|
158386416 |
arpandesai0 |
A |
May 25, 2022, 12:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158577574 |
Chris132 |
A |
May 27, 2022, 3:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158561366 |
raghad__ns |
A |
May 26, 2022, 7:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158530592 |
nadim28 |
A |
May 26, 2022, 1:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158488579 |
KOD_TiTAN |
A |
May 26, 2022, 4:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158391816 |
Camo0112 |
A |
May 25, 2022, 1:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158382699 |
omarsalem33 |
A |
May 25, 2022, 11:25 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158382558 |
spam_ak |
A |
May 25, 2022, 11:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
307200 |
|
|
158123038 |
UpMing |
A |
May 23, 2022, 7:44 a.m. |
OK |
Go |
TESTS |
7 |
31 |
1433600 |
|
|
158122457 |
UpMing |
A |
May 23, 2022, 7:36 a.m. |
OK |
Go |
TESTS |
7 |
545 |
1331200 |
|
|
158371008 |
kuo3 |
A |
May 25, 2022, 9:21 a.m. |
OK |
Haskell |
TESTS |
8 |
77 |
13619200 |
|
|
158488825 |
atulanand206 |
A |
May 26, 2022, 4:28 a.m. |
OK |
Java 11 |
TESTS |
8 |
155 |
0 |
|
|
158478885 |
nballman |
A |
May 26, 2022, 12:20 a.m. |
OK |
Java 11 |
TESTS |
8 |
155 |
0 |
|
|
158320503 |
iamsoumik |
A |
May 24, 2022, 4:49 p.m. |
OK |
Java 11 |
TESTS |
8 |
155 |
0 |
|
|
158119267 |
_Astron |
A |
May 23, 2022, 6:49 a.m. |
OK |
Java 11 |
TESTS |
7 |
155 |
0 |
|
|
158313827 |
suhas5979 |
A |
May 24, 2022, 3:35 p.m. |
OK |
Java 11 |
TESTS |
8 |
156 |
0 |
|
|
158244409 |
MrOtter |
A |
May 23, 2022, 8:30 p.m. |
OK |
Java 11 |
TESTS |
8 |
156 |
0 |
|
|
158104243 |
Ayyylmao |
A |
May 23, 2022, 2:18 a.m. |
OK |
Java 11 |
TESTS |
7 |
156 |
0 |
|
|
158308063 |
ayushgaur02 |
A |
May 24, 2022, 2:32 p.m. |
OK |
Java 11 |
TESTS |
8 |
170 |
0 |
|
|
158148886 |
faild-in-2021 |
A |
May 23, 2022, 1:38 p.m. |
OK |
Java 11 |
TESTS |
8 |
170 |
0 |
|
|
158534363 |
this_is_Shivesh |
A |
May 26, 2022, 1:53 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
158350857 |
Swapniltri |
A |
May 25, 2022, 5:03 a.m. |
OK |
Java 8 |
TESTS |
8 |
93 |
0 |
|
|
158336990 |
dev_14 |
A |
May 24, 2022, 9:16 p.m. |
OK |
Java 8 |
TESTS |
8 |
93 |
0 |
|
|
158127168 |
_ryan18_ |
A |
May 23, 2022, 8:47 a.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
158125009 |
kewosihuzuobudao |
A |
May 23, 2022, 8:15 a.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
158122533 |
akki_rathore |
A |
May 23, 2022, 7:37 a.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
158114506 |
Main.Thread |
A |
May 23, 2022, 5:39 a.m. |
OK |
Java 8 |
TESTS |
7 |
93 |
0 |
|
|
158533336 |
C_P_T_N |
A |
May 26, 2022, 1:42 p.m. |
OK |
Java 8 |
TESTS |
8 |
108 |
0 |
|
|
158532920 |
DEMO23 |
A |
May 26, 2022, 1:38 p.m. |
OK |
Java 8 |
TESTS |
8 |
108 |
0 |
|
|
158128538 |
sandy11jr |
A |
May 23, 2022, 9:07 a.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
0 |
|
|
158108566 |
BhargavModha |
A |
May 23, 2022, 3:55 a.m. |
OK |
Java 8 |
TESTS |
7 |
108 |
0 |
|
|
158120876 |
ripity |
A |
May 23, 2022, 7:13 a.m. |
OK |
Kotlin 1.6 |
TESTS |
7 |
155 |
0 |
|
|
158249882 |
housni |
A |
May 23, 2022, 11:04 p.m. |
OK |
Kotlin 1.6 |
TESTS |
8 |
186 |
0 |
|
|
158323329 |
mohamedbakr |
A |
May 24, 2022, 5:23 p.m. |
OK |
Mono C# |
TESTS |
8 |
77 |
716800 |
|
|
158145924 |
Vaibhav111 |
A |
May 23, 2022, 1:01 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
0 |
307200 |
|
|
158105354 |
buhuidaima |
A |
May 23, 2022, 2:47 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
15 |
102400 |
|
|
158267873 |
gao_wu_di |
A |
May 24, 2022, 5:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
307200 |
|
|
158243249 |
Damirca |
A |
May 23, 2022, 8:07 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
307200 |
|
|
158121966 |
digjoynandi12 |
A |
May 23, 2022, 7:28 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
15 |
307200 |
|
|
158365298 |
A_Pier |
A |
May 25, 2022, 8:31 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
307200 |
|
|
158289345 |
xsc |
A |
May 24, 2022, 10:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
307200 |
|
|
158396395 |
Hamo123 |
A |
May 25, 2022, 2:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
15 |
1945600 |
|
|
158396463 |
Serg108N |
A |
May 25, 2022, 2:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
31 |
307200 |
|
|
158111388 |
yoralbayev |
A |
May 23, 2022, 4:50 a.m. |
OK |
PHP |
TESTS |
7 |
77 |
0 |
|
|
158131506 |
a_vantik_a |
A |
May 23, 2022, 9:50 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
93 |
2662400 |
|
|
158253833 |
jscn |
A |
May 24, 2022, 1:30 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
108 |
2662400 |
|
|
158288112 |
ambs_ |
A |
May 24, 2022, 10:40 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
108 |
3788800 |
|
|
158119825 |
ArjitShrivastava |
A |
May 23, 2022, 6:57 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
124 |
2662400 |
|
|
158118677 |
practise_iiitb |
A |
May 23, 2022, 6:41 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
124 |
2867200 |
|
|
158292572 |
JUBHAI |
A |
May 24, 2022, 11:35 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
124 |
5120000 |
|
|
158348148 |
Mueez_Aizdi |
A |
May 25, 2022, 4:05 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
140 |
4812800 |
|
|
158281243 |
manohar2509 |
A |
May 24, 2022, 9:05 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
140 |
5222400 |
|
|
158239563 |
hxu10 |
A |
May 23, 2022, 7:06 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
155 |
4812800 |
|
|
158158671 |
hiardik45_exe |
A |
May 23, 2022, 2:42 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
155 |
4812800 |
|
|
158564668 |
nealzane |
A |
May 26, 2022, 8:22 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
61 |
4198400 |
|
|
158129835 |
tushar26427 |
A |
May 23, 2022, 9:25 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
62 |
2560000 |
|
|
158223472 |
Code_100 |
A |
May 23, 2022, 4:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
77 |
3276800 |
|
|
158264341 |
abineth |
A |
May 24, 2022, 5 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
77 |
3481600 |
|
|
158220969 |
Code_100 |
A |
May 23, 2022, 4:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
77 |
3481600 |
|
|
158122062 |
zeero1778 |
A |
May 23, 2022, 7:30 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
77 |
3584000 |
|
|
158292060 |
codingaccnt |
A |
May 24, 2022, 11:29 a.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
77 |
3686400 |
|
|
158127099 |
skp_r |
A |
May 23, 2022, 8:46 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
77 |
4300800 |
|
|
158104682 |
rajeshpenugonda6 |
A |
May 23, 2022, 2:29 a.m. |
OK |
PyPy 3-64 |
TESTS |
7 |
78 |
3686400 |
|
|
158389422 |
satyamshrma |
A |
May 25, 2022, 12:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
93 |
4198400 |
|
|
158498238 |
Harsha3408 |
A |
May 26, 2022, 6:45 a.m. |
OK |
Python 3 |
TESTS |
8 |
31 |
204800 |
|
|
158334767 |
MishaTsekh |
A |
May 24, 2022, 8:19 p.m. |
OK |
Python 3 |
TESTS |
8 |
31 |
204800 |
|
|
158284078 |
what_is_63298125 |
A |
May 24, 2022, 9:43 a.m. |
OK |
Python 3 |
TESTS |
8 |
31 |
204800 |
|
|
158404572 |
Rudradip |
A |
May 25, 2022, 3:44 p.m. |
OK |
Python 3 |
TESTS |
8 |
46 |
512000 |
|
|
158108281 |
vp2002 |
A |
May 23, 2022, 3:49 a.m. |
OK |
Python 3 |
TESTS |
7 |
46 |
512000 |
|
|
158112261 |
sushant_7580 |
A |
May 23, 2022, 5:02 a.m. |
OK |
Python 3 |
TESTS |
7 |
61 |
204800 |
|
|
158139273 |
blackhunter |
A |
May 23, 2022, 11:40 a.m. |
OK |
Python 3 |
TESTS |
8 |
61 |
512000 |
|
|
158134899 |
sarius129 |
A |
May 23, 2022, 10:41 a.m. |
OK |
Python 3 |
TESTS |
7 |
61 |
512000 |
|
|
158255333 |
try_to_reach_next_rank |
A |
May 24, 2022, 2:07 a.m. |
OK |
Python 3 |
TESTS |
8 |
61 |
614400 |
|
|
158107804 |
hupr |
A |
May 23, 2022, 3:39 a.m. |
OK |
Python 3 |
TESTS |
7 |
62 |
204800 |
|
|
remove filters
Back to search problems