+ 2

Maximum distance same characers

Hello I have come across this problem https://code.sololearn.com/cnQb8j2tO05k/?ref=app for this problem there are 15 private hidden testcases are there for my code only 13 testcases are passed 2 testcases failed could you please tell me what could be the private testcases.

24th Oct 2020, 3:18 PM
Varshith
Varshith - avatar
6 Respostas
24th Oct 2020, 6:52 PM
Vitaly Sokol
Vitaly Sokol - avatar
0
Hello QTWizard Could you explain which test case might be failed for my code.
24th Oct 2020, 4:14 PM
Varshith
Varshith - avatar
0
Voleti Varshith Well, i think you need to check if there any type of repeated punctuations like: ,Hellomadam, This will return ,11 i don't understand what your formula abs(...) trying to compute. Anyway, your code works fine, but i think you need to eliminate any type of punctuations. I have updated my code to print only the longest distance between alphabetical chars. so the previous case will return m4 and not ,11
24th Oct 2020, 4:43 PM
QTWizard
0
Actually it was asked in a test.The test was completed so I just want to know which test cases failed for my code.
24th Oct 2020, 4:59 PM
Varshith
Varshith - avatar
0
The code inside the abs function finds the last occurring letter in a string and subtracts the first occurring element .This could be write without using abs function also.
24th Oct 2020, 5:08 PM
Varshith
Varshith - avatar
- 1
According to my logic, the following solution should work on all cases you can think of. https://code.sololearn.com/ctdQ0gTSv8jO/?ref=app
24th Oct 2020, 3:45 PM
QTWizard